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
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 47 def create @item_has_use_restriction = ItemHasUseRestriction.new(params[:item_has_use_restriction]) respond_to do |format| if @item_has_use_restriction.save flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.item_has_use_restriction')) format.html { redirect_to @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
81 82 83 84 85 86 87 88 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 81 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
41 42 43 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 41 def edit @use_restrictions = UseRestriction.all end |
#index ⇒ Object
GET /item_has_use_restrictions GET /item_has_use_restrictions.json
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 7 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
31 32 33 34 35 36 37 38 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 31 def 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
22 23 24 25 26 27 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 22 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
65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'app/controllers/item_has_use_restrictions_controller.rb', line 65 def update respond_to do |format| if @item_has_use_restriction.update_attributes(params[:item_has_use_restriction]) flash[:notice] = t('controller.successfully_updated', :model => t('activerecord.models.item_has_use_restriction')) format.html { redirect_to @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 |