On 12 Jan 2010, at 18:46, John Merlino wrote:
>>
>> Well, I changed it around. I think this is what you were talking about:
>>
>> class StudentState < ActiveRecord::Base
>> has_many :students
>> end
>>
>> class Student < ActiveRecord::Base
>> belongs_to :student_state
>> named_scope :status, :joins => :student_state, => {'student_state.state'
>> => ?, :state}
>> end
Not quite - since you've got a parameter you have to use the lambda form (when
I said you had to use the hash form or the lambda form I was talking in
generalities), so you need
named_scope :status, lambda {|...| { :conditions => ..., :joins => ... }
Fred
--
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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.