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