Class: ItemHasUseRestrictionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ItemHasUseRestrictionsController
- Defined in:
- app/controllers/item_has_use_restrictions_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /item_has_use_restrictions POST /item_has_use_restrictions.json.
-
#destroy ⇒ Object
DELETE /item_has_use_restrictions/1 DELETE /item_has_use_restrictions/1.json.
-
#edit ⇒ Object
GET /item_has_use_restrictions/1/edit.
-
#index ⇒ Object
GET /item_has_use_restrictions GET /item_has_use_restrictions.json.
-
#new ⇒ Object
GET /item_has_use_restrictions/new GET /item_has_use_restrictions/new.json.
-
#show ⇒ Object
GET /item_has_use_restrictions/1 GET /item_has_use_restrictions/1.json.
-
#update ⇒ Object
PUT /item_has_use_restrictions/1 PUT /item_has_use_restrictions/1.json.
Instance Method Details
#create ⇒ Object
POST /item_has_use_restrictions POST /item_has_use_restrictions.json
49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 49 def create @item_has_use_restriction = ItemHasUseRestriction.new(item_has_use_restriction_params) respond_to do |format| if @item_has_use_restriction.save format.html { redirect_to @item_has_use_restriction, notice: t('controller.successfully_created', model: t('activerecord.models.item_has_use_restriction')) } format.json { render json: @item_has_use_restriction, status: :created, location: @item_has_use_restriction } else @use_restrictions = UseRestriction.all format.html { render action: "new" } format.json { render json: @item_has_use_restriction.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /item_has_use_restrictions/1 DELETE /item_has_use_restrictions/1.json
82 83 84 85 86 87 88 89 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 82 def destroy @item_has_use_restriction.destroy respond_to do |format| format.html { redirect_to item_has_use_restrictions_url } format.json { head :no_content } end end |
#edit ⇒ Object
GET /item_has_use_restrictions/1/edit
43 44 45 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 43 def edit @use_restrictions = UseRestriction.all end |
#index ⇒ Object
GET /item_has_use_restrictions GET /item_has_use_restrictions.json
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 8 def index if @item @item_has_use_restrictions = @item.item_has_use_restrictions.order('item_has_use_restrictions.id DESC').page(params[:page]) else @item_has_use_restrictions = ItemHasUseRestriction.order('id DESC').page(params[:page]) end respond_to do |format| format.html # index.html.erb format.json { render json: @item_has_use_restrictions } end end |
#new ⇒ Object
GET /item_has_use_restrictions/new GET /item_has_use_restrictions/new.json
32 33 34 35 36 37 38 39 40 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 32 def new @item_has_use_restriction = ItemHasUseRestriction.new @use_restrictions = UseRestriction.all respond_to do |format| format.html # new.html.erb format.json { render json: @item_has_use_restriction } end end |
#show ⇒ Object
GET /item_has_use_restrictions/1 GET /item_has_use_restrictions/1.json
23 24 25 26 27 28 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 23 def show respond_to do |format| format.html # show.html.erb format.json { render json: @item_has_use_restriction } end end |
#update ⇒ Object
PUT /item_has_use_restrictions/1 PUT /item_has_use_restrictions/1.json
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 66 def update @item_has_use_restriction.assign_attributes(item_has_use_restriction_params) respond_to do |format| if @item_has_use_restriction.save format.html { redirect_to @item_has_use_restriction, notice: t('controller.successfully_updated', model: t('activerecord.models.item_has_use_restriction')) } format.json { head :no_content } else @use_restrictions = UseRestriction.all format.html { render action: "edit" } format.json { render json: @item_has_use_restriction.errors, status: :unprocessable_entity } end end end |