This project is archived and is in readonly mode.
Add query-attribute methods to associations
-
Jeremy Kemper
Ah, that's pretty nice..
-
Michael Koziarski
don't we already have has_comments?
-
Jeff Dean
I don't see a has_tasks? method in irb or in the docs.
class Project < ActiveRecord::Base has_many :tasks end class Task < ActiveRecord::Base belongs_to :project end >> puts Project.new.methods.sort.select{|m| m=~ /task/} after_create_or_update_associated_records_for_tasks before_save_associated_records_for_tasks task task_ids task_ids= tasks tasks= validate_associated_records_for_tasks -
Michael Koziarski
Oh right, we deprecated it and removed it for 2.0 in favour of people.empty? etc.
If jeremy's down with the addition then I'm for it too :)
-
Pratik
- Title changed from [PATCH] - Add query-attribute methods to associations to Add query-attribute methods to associations
-
Pratik
- Assigned user set to Pratik
- State changed from new to incomplete
- Milestone cleared.
Ok Jeremy likes it. So lets add it :-)
Jeff, could you please generate a new patch git-format-patch ? You can find details at http://rails.lighthouseapp.com/p...
Also, could you add tests to check the association doesn't get loaded when someone calls association? method.
Thanks.
-
CancelProfileIsBroken
- Tag set to activerecord, bugmash, edge, enhancement, has_many, patch, tested
-
Jeff Dean
I forgot this patch was still out there!
Since we now have .present?, this patch could be simplified to just adding an alias. However, since we have .present?, and it's hip and super readable, we could also just delete this ticket.
-
CancelProfileIsBroken
- Tag changed from activerecord, bugmash, edge, enhancement, has_many, patch, tested to activerecord, edge, enhancement, has_many, patch, tested
- State changed from incomplete to resolved
Closing, since we now have a better alternative. Thanks for the update Jeff.
-
CancelProfileIsBroken
Closing, since we now have a better alternative. Thanks for the update Jeff.
