Sha256: 59d9b486378afc5495d3d99da99fc45867d71c67c5cbce7ac33b59b6426df255
Contents?: true
Size: 1.24 KB
Versions: 34
Compression:
Stored size: 1.24 KB
Contents
class Admin::Muck::RolesController < Admin::Muck::BaseController unloadable def index @user = User.find(params[:user_id]) @all_roles = Role.find(:all) end def show @role = Role.new(params[:role]) end def new @role = Role.new(params[:role]) end # POST /websites # POST /websites.xml def create @role = Role.new(params[:role]) respond_to do |format| if @role.save flash[:notice] = I18n.t('muck.roles.role_created') format.html { redirect_to(admin_roles_path(@role)) } format.xml { render :xml => @role, :status => :created, :location => @role } else format.html { render :action => "new" } format.xml { render :xml => @role.errors, :status => :unprocessable_entity } end end end def edit @role = Role.new(params[:role]) end def update @user = User.find(params[:user_id]) @role = Role.find(params[:id]) unless @user.has_role?(@role.rolename) @user.roles << @role end redirect_to :action => 'index' end def destroy @user = User.find(params[:user_id]) @role = Role.find(params[:id]) if @user.has_role?(@role.rolename) @user.roles.delete(@role) end redirect_to :action => 'index' end end
Version data entries
34 entries across 34 versions & 1 rubygems