In my Video model i have:
class Video < Media
scope :genre, where(['genres.name = ?',
params[:genre].capitalize]).includes({:artist => {:user => :genre}})
....
end
As you see above, params[:genre].capitalize is a dynamic value. How do
I pass a value when I call Video.genre?
Or are we not allowed to pass attributes/values to named scopes?
Should I use a function instead? For example:
def find_by_genre(genre)
self.where(['genres.name = ?', genre).includes({:artist => {:user
=> :genre}})
end
--
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.