This is written as a bug, but is probably an RFE. Or at least a request to add a warning.
Overview
For uses clauses, we currently don't support nested attributes:
class Book
has_and_belongs_to_many :co_authors, :class_name => "Author"
end
class Author
virtual_has_one :book_with_most_bookmarks, :uses => {:books => :bookmarks}
virtual_has_many :famous_co_authors, :uses => {:book_with_most_bookmarks => :co_authors} ## HERE
end
Issue
Above, it is not obvious what the value of the includes should be:
- option 1:
{:books => {:bookmarks => :co_authors}}
- option 2:
{:books => [:bookmarks, :co_authors]}
Currently we ignore the target, so we basically read the definition as the following:
class Author
virtual_has_many :famous_co_authors, :uses => :book_with_most_bookmarks
end
We currently do not have the need to support this feature, but I noticed it while writing tests for another issue.
Options
We have a few ways to move forward:
- continue ignoring the target
(developer can write it a different way)
- add a warning
- throw an exception
- look at the klass of the association and determine the best way
(this involves introspection of another class which has caused class loader deadlocks in the past)
This is written as a bug, but is probably an RFE. Or at least a request to add a warning.
Overview
For uses clauses, we currently don't support nested attributes:
Issue
Above, it is not obvious what the value of the includes should be:
{:books => {:bookmarks => :co_authors}}{:books => [:bookmarks, :co_authors]}Currently we ignore the target, so we basically read the definition as the following:
We currently do not have the need to support this feature, but I noticed it while writing tests for another issue.
Options
We have a few ways to move forward:
(developer can write it a different way)
(this involves introspection of another class which has caused class loader deadlocks in the past)