Class: RolesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- RolesController
- Defined in:
- app/controllers/roles_controller.rb
Instance Method Summary collapse
-
#edit ⇒ Object
GET /roles/1/edit.
-
#index ⇒ Object
GET /roles GET /roles.json.
-
#show ⇒ Object
GET /roles/1 GET /roles/1.json.
-
#update ⇒ Object
PUT /roles/1 PUT /roles/1.json.
Instance Method Details
#edit ⇒ Object
GET /roles/1/edit
26 27 |
# File 'app/controllers/roles_controller.rb', line 26 def edit end |
#index ⇒ Object
GET /roles GET /roles.json
7 8 9 10 11 12 13 14 |
# File 'app/controllers/roles_controller.rb', line 7 def index @roles = Role.order(:position) respond_to do |format| format.html # index.html.erb format.json { render json: @roles } end end |
#show ⇒ Object
GET /roles/1 GET /roles/1.json
18 19 20 21 22 23 |
# File 'app/controllers/roles_controller.rb', line 18 def show respond_to do |format| format.html # show.html.erb format.json { render json: @role } end end |
#update ⇒ Object
PUT /roles/1 PUT /roles/1.json
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'app/controllers/roles_controller.rb', line 31 def update if params[:move] move_position(@role, params[:move]) return end respond_to do |format| if @role.update(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 |