> But you are wrong. The view should never, ever, ever touch theIs it considered ok to call model methods if they do not touch the db,
> database.
or are model methods forbidden also?
I would say the view can call instance methods of the model (attributes - real and virtual) but no class methods.
So:
<%= @user.name %>
is OK, but:
<% User.first.name %>
is not. It's a bit of a contrived example, but there you go. Accessing the model through instance variables you've created is OK, going directly to the model bypassing the controller is not.
Cheers,
Andy
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