Frederick Cheung wrote:
> On 12 Jan 2010, at 18:46, John Merlino wrote:
>>> => ?, :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

named_scope :status, lambda { |key|
  { :joins => :student_state, :conditions => ["student_state.key = ?", 
key], :limit => 20 }
}

The above ended up working. However, I thought that the inner join I 
specified would make the attributes of student_state available in the 
xml output of the students controller (when going to the url 
http://localhost:3000/students.xml). But it wasn't. Is this a limitation 
of rail's xml capabilities?
-- 
Posted via http://www.ruby-forum.com/.
-- 
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.


Reply via email to