Class: UseRestrictionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- UseRestrictionsController
- Defined in:
- app/controllers/use_restrictions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /use_restrictions POST /use_restrictions.json.
-
#destroy ⇒ Object
DELETE /use_restrictions/1 DELETE /use_restrictions/1.json.
-
#edit ⇒ Object
GET /use_restrictions/1/edit.
-
#index ⇒ Object
GET /use_restrictions GET /use_restrictions.json.
-
#new ⇒ Object
GET /use_restrictions/new GET /use_restrictions/new.json.
-
#show ⇒ Object
GET /use_restrictions/1 GET /use_restrictions/1.json.
-
#update ⇒ Object
PUT /use_restrictions/1 PUT /use_restrictions/1.json.
Instance Method Details
#create ⇒ Object
POST /use_restrictions POST /use_restrictions.json
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/controllers/use_restrictions_controller.rb', line 41 def create @use_restriction = UseRestriction.new(use_restriction_params) respond_to do |format| if @use_restriction.save format.html { redirect_to @use_restriction, notice: t('controller.successfully_created', model: t('activerecord.models.use_restriction')) } format.json { render json: @use_restriction, status: :created, location: @use_restriction } else format.html { render action: "new" } format.json { render json: @use_restriction.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /use_restrictions/1 DELETE /use_restrictions/1.json
76 77 78 79 80 81 82 83 |
# File 'app/controllers/use_restrictions_controller.rb', line 76 def destroy @use_restriction.destroy respond_to do |format| format.html { redirect_to use_restrictions_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /use_restrictions/1/edit
36 37 |
# File 'app/controllers/use_restrictions_controller.rb', line 36 def edit end |
#index ⇒ Object
GET /use_restrictions GET /use_restrictions.json
6 7 8 9 10 11 12 13 |
# File 'app/controllers/use_restrictions_controller.rb', line 6 def index @use_restrictions = UseRestriction.order(:position) respond_to do |format| format.html # index.html.erb format.json { render json: @use_restrictions } end end |
#new ⇒ Object
GET /use_restrictions/new GET /use_restrictions/new.json
26 27 28 29 30 31 32 33 |
# File 'app/controllers/use_restrictions_controller.rb', line 26 def new @use_restriction = UseRestriction.new respond_to do |format| format.html # new.html.erb format.json { render json: @use_restriction } end end |
#show ⇒ Object
GET /use_restrictions/1 GET /use_restrictions/1.json
17 18 19 20 21 22 |
# File 'app/controllers/use_restrictions_controller.rb', line 17 def show respond_to do |format| format.html # show.html.erb format.json { render json: @use_restriction } end end |
#update ⇒ Object
PUT /use_restrictions/1 PUT /use_restrictions/1.json
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'app/controllers/use_restrictions_controller.rb', line 57 def update if params[:move] move_position(@use_restriction, params[:move]) return end respond_to do |format| if @use_restriction.update_attributes(use_restriction_params) format.html { redirect_to @use_restriction, notice: t('controller.successfully_updated', model: t('activerecord.models.use_restriction')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @use_restriction.errors, status: :unprocessable_entity } end end end |