Thursday, June 3, 2010

[Rails] Why doesn't this helper work?

So I'm cleaning up my views at the moment, and thought it'd be nice to
create a couple of helpers, one that shows links if the user is logged
in, and one that shows another set of links if they're not logged in.

Anyways, this is the code:

def logged_in_links
if logged_in?
link_to 'New Highlight', new_highlight_path
link_to 'Logout?', logout_path
link_to 'Profile »', @current_user.login
end
end

I'm sure I'm making a rudimentary mistake (take into account I am a
beginner), but whenever I execute the helper method only the last link
shows up, and if I remove the last link than it's the new last link that
displays etc.

What am I doing wrong? :-)
--
Posted via http://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-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.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate