Re: Design Review: Business Object Permissions in my Models

If you are using Restful Authentication look at the authenticated_system.rb file.  There are a number of methods you can use.  Listed is the following method:

  # Returns true or false if the user is logged in.
    # Preloads @current_user with the user model if they're logged in.
    def logged_in?
      !!current_user
    end

Your check becomes:

<% if logged_in? && current_user.can_view_item? %>

Last edited by sandy (2008-07-10 05:33:47)