Class: Admin::RolesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Admin::RolesController
- Defined in:
- app/controllers/wafflemix/admin/roles_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 39 def create @role = Role.new(params[:role]) respond_to do |format| if @role.save format.html { redirect_to [:admin, @role], notice: 'Role was successfully created.' } format.json { render json: @role, status: :created, location: @role } else format.html { render action: "new" } format.json { render json: @role.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 67 def destroy @role = Role.find(params[:id]) @role.destroy respond_to do |format| format.html { redirect_to admin_roles_path } format.json { head :no_content } end end |
#edit ⇒ Object
35 36 37 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 35 def edit @role = Role.find(params[:id]) end |
#index ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 8 def index @roles = Role.all respond_to do |format| format.html format.json { render json: @roles } end end |
#new ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 26 def new @role = Role.new respond_to do |format| format.html format.json { render json: @role } end end |
#show ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 17 def show @role = Role.find(params[:id]) respond_to do |format| format.html format.json { render json: @role } end end |
#update ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/wafflemix/admin/roles_controller.rb', line 53 def update @role = Role.find(params[:id]) respond_to do |format| if @role.update_attributes(params[:role]) format.html { redirect_to [:admin, @role], notice: 'Role was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @role.errors, status: :unprocessable_entity } end end end |