>
> > But you are wrong.  The view should never, ever, ever touch the
> > database.
>
> Is it considered ok to call model methods if they do not touch the db,
> 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 [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.

Reply via email to