Hi all,
I can't get this named scope to work. Each store has a number of
users. Each store can have one manager. I ant to use a nemed scope to
find the manager by name. Have I got this totally backwards?
Help appreciated
:-) jonas
class Store < ActiveRecord::Base
has_many :users, :dependent => :destroy
belongs_to :manager, :class_name => "User", :foreign_key =>
"manager_id"
named_scope :manager_name, lambda{|name| {:include
=> :manager, :conditions => ['manager.name = ?', name ]}}
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment