Class: Admin::RolesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::RolesController
- Defined in:
- app/controllers/admin/roles_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
rubocop:todo Metrics/MethodLength.
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
Instance Method Details
#create ⇒ Object
rubocop:todo Metrics/MethodLength
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/controllers/admin/roles_controller.rb', line 35 def create # rubocop:todo Metrics/MethodLength @role = Role.new(params[:role]) respond_to do |format| if @role.save flash[:notice] = 'Role was successfully created.' format.html { redirect_to(@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 |
#index ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/admin/roles_controller.rb', line 8 def index @roles = Role.group(:name).pluck(:name) respond_to do |format| format.html # index.html.erb format.xml { render xml: @roles } end end |
#new ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/admin/roles_controller.rb', line 26 def new @role = Role.new respond_to do |format| format.html # new.html.erb format.xml { render xml: @role } end end |
#show ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/admin/roles_controller.rb', line 17 def show @role = Role.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render xml: @role } end end |