Acts As Menu Role plugin

Plugin details

ActsAsMenuRole is a plugin for simplify menu's creation for a particular role and controller, is based on role_requirement [1] and restful_authentication (or acts_as_authenticated).

Websitehttp://code.google.com/p/actsasmenurole/ Repositoryhttp://actsasmenurole.googlecode.com/svn/tags/acts_as_menu_role/ Author Gastón Ramos Tags menu, Roles LicenseUnknown

Documentation

Install the plugin:
ruby script/plugin install http://actsasmenurole.googlecode.com/svn/tags/acts_as_menu_role/

Example
=======

class UsersController < ApplicationController

  # Menu for all roles
  menu_role :default, { :login => "Login", :logout => "Log out" }

  # Menu for :admin role
  menu_role :admin, { :list => "View all accounts" }

  def new
  end

  def create
    cookies.delete :auth_token
    # protects against session fixation attacks, wreaks havoc with
    # request forgery protection.
    # uncomment at your own risk
    # reset_session
    @user = User.new(params[:user])

    @user.save!
    self.current_user = @user
    redirect_back_or_default('/')
    flash[:notice] = "Thanks for signing up!"
  rescue ActiveRecord::RecordInvalid
    render :action => 'new'
  end

end

Further Documentation

There is currently no advanced documentation for this plugin.

New documentation

Edit plugin | (0 older versions) | Last edited by: Guest, 7 months ago