Ruby on Rails Sunday, July 31, 2011

On Jul 31, 1:03 pm, 7stud -- <li...@ruby-forum.com> wrote:
> It follows that the line:
>
> <%= current_user.name %>
>
> actually does this:
>
> <%= current_user().name %>

Punctuation is usually optional in ruby when this doesn't introduce
ambiguities.

>
> What I found to be a new concept in this section of the book is that we
> can
> call methods in the view that are inherited by the
> controller:

You can't. The reason why the methods in SessionsHelper can be used in
the view is that (by default) all the helpers in app/helpers are
included in views.
When you add the method directly to the controller then this no longer
holds and so the view can't find the method

Fred

--
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