Sha256: 07e751e4c97417a47ccf23a064832d205d495565b93aec6f5c4493fd4fd1a454
Contents?: true
Size: 1.15 KB
Versions: 8
Compression:
Stored size: 1.15 KB
Contents
class RolesController < ApplicationController load_and_authorize_resource except: :index authorize_resource only: :index # GET /roles # GET /roles.json def index @roles = Role.order(:position) respond_to do |format| format.html # index.html.erb format.json { render json: @roles } end end # GET /roles/1 # GET /roles/1.json def show respond_to do |format| format.html # show.html.erb format.json { render json: @role } end end # GET /roles/1/edit def edit end # PUT /roles/1 # PUT /roles/1.json def update if params[:move] move_position(@role, params[:move]) return end respond_to do |format| if @role.update_attributes(role_params) format.html { redirect_to @role, notice: t('controller.successfully_updated', model: t('activerecord.models.role')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @role.errors, status: :unprocessable_entity } end end end private def role_params params.require(:role).permit(:name, :display_name, :note) end end
Version data entries
8 entries across 8 versions & 1 rubygems