On 2 April 2010 09:06, jeb <jo...@ibiz.se> wrote:
> 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 don't say what errors you're getting, but I'd suggest that if your
tables follow the naming conventions, the conditions should be:
  :conditions => ['managers.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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to