Hello guys!
Question:
Views should be "dumb" and models should deal with db queries...
but what if you have a situation like so
class User < ActiveRecord::Base
def has_relationship_with?( other_user )
!relationships.find_by_other_user_id( other_user.id ).nil?
end
end
and then in your view:
<%= "Display this message" if @user.has_relationship_with?
(@other_user) %>
Is it cool to call model methods which, in turn, query the db within
the view or is there a better way of implementing this?
Thanks
ASH
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---