2009/11/19 pharrington <[email protected]>

>
> For simple cases you could just create a helper like this:
> def admin_only &blk
>   yield if current_user.admin?
> end
>
> <% admin_only do %>
>  some ISH
> <% end %>
>
>
or a helper like:
def show_user_info
  if (current_user.admin?) do
    'User is admin.'
  elsif (current_user.loggedin?) do
    'User is logged in.'
  else
    'Another case'
  end
end

and on the templates simply:
<%= show_user_info %>

regards
-- 
------------------------------------
Oliver Hernàndez Valls

http://codit.wikidot.com
http://bolets.negocis.cat
http://wiki.tramuntanal.cat

--

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


Reply via email to