#480 new
Dirkjan Bussink

Finders should support associations properly

Reported by Dirkjan Bussink | July 24th, 2008 @ 01:38 AM

It should be possible to do the following:

Address.all(:person => Person.first)

Or:

Address.all(Address.person => Person.first)

Currently someone has to do something like:

Address.all(Address.person.id => Person.first.id)

This is not only ugly, but also problematic for stuff like composite keys. Furthermore, the user has to handle stuff like Person.first being nil, which should also work automatically.

Comments and changes to this ticket

  • Dirkjan Bussink

    Dirkjan Bussink July 24th, 2008 @ 01:32 PM

    Seems close to working btw, it fails on:

    NoMethodError in 'CostCenter with regard to generating timecards should be able to retrieve all registrations for a certain cost center'

    private method `gsub' called for nil:NilClass

    /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/adapters/mysql_adapter.rb:21:in `quote_column_name'

    /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/adapters/data_objects_adapter.rb:375:in `original_property_to_column_name'

    /Library/Ruby/Gems/1.8/gems/dm-aggregates-0.9.3/lib/dm-aggregates/adapters/data_objects_adapter.rb:58:in `property_to_column_name'

    /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/adapters/data_objects_adapter.rb:324:in `condition_statement'

    /Library/Ruby/Gems/1.8/gems/dm-core-0.9.3/lib/dm-core/adapters/data_objects_adapter.rb:322:in `map'

    This is because the property in there is a DataMapper::Query::Path and not a Property object.

Please Login or create a free account to add a new comment.

You can update this ticket by sending an email to from your email client. (help)

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

Shared Ticket Bins

People watching this ticket