Hello everyone,
For this model:
class User < ActiveRecord::Base
has_many :component_users, :dependent => :destroy
has_many :components, :through => :component_users, :conditions =>
[''components.active = ?'',true]
accepts_nested_attributes_for :component_users, :reject_if => lambda
{ |a| a[:components].blank? || a[:components]
[:name].blank? }, :allow_destroy => true
end
How can I sort a user.component_users by a order attribute on the
Component model?
Like user.component_users.sort{|a,b| a.component.order <=>
b.component.order}
Thanks
Thiago
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.