On Jan 27, 10:31 pm, John Merlino <li...@ruby-forum.com> wrote:

> Students Model
> named_scope :contactable, lambda { |current_user|
>
>     case
>     when current_user.contact.contactable_id = 1 &&
> current_user.contact.contactable_type = 'site' then
>        { :conditions => {:site_id => 1}}
>        when current_user.contact.contactable_id = 2 &&
> current_user.contact.contactable_type = 'site' then
>        { :conditions => {:site_id => 2}}
>     end

This looks odd - you've got single equals when you probable wanted to
compare and not assign

Fred
>
> Model relationships:
> A contact has_one user. A contact belongs_to site via contactable_id and
> contactable_type (polymorphic relationship). A site has_many students.
>
> Any suggestion or clue as to why the named_scope doesn't show students
> with site_id same as the current_user?
> --
> Posted viahttp://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 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