Class: CarrierTypesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- CarrierTypesController
- Defined in:
- app/controllers/carrier_types_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /carrier_types POST /carrier_types.json.
-
#destroy ⇒ Object
DELETE /carrier_types/1 DELETE /carrier_types/1.json.
-
#edit ⇒ Object
GET /carrier_types/1/edit.
-
#index ⇒ Object
GET /carrier_types GET /carrier_types.json.
-
#new ⇒ Object
GET /carrier_types/new GET /carrier_types/new.json.
-
#show ⇒ Object
GET /carrier_types/1 GET /carrier_types/1.json.
-
#update ⇒ Object
PUT /carrier_types/1 PUT /carrier_types/1.json.
Instance Method Details
#create ⇒ Object
POST /carrier_types POST /carrier_types.json
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/carrier_types_controller.rb', line 42 def create @carrier_type = CarrierType.new(carrier_type_params) respond_to do |format| if @carrier_type.save format.html { redirect_to @carrier_type, notice: t('controller.successfully_created', model: t('activerecord.models.carrier_type')) } format.json { render json: @carrier_type, status: :created, location: @carrier_type } else format.html { render action: "new" } format.json { render json: @carrier_type.errors, status: :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /carrier_types/1 DELETE /carrier_types/1.json
79 80 81 82 83 84 85 86 |
# File 'app/controllers/carrier_types_controller.rb', line 79 def destroy @carrier_type.destroy respond_to do |format| format.html { redirect_to carrier_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.carrier_type')) } format.json { head :no_content } end end |
#edit ⇒ Object
GET /carrier_types/1/edit
37 38 |
# File 'app/controllers/carrier_types_controller.rb', line 37 def edit end |
#index ⇒ Object
GET /carrier_types GET /carrier_types.json
7 8 9 10 11 12 13 14 |
# File 'app/controllers/carrier_types_controller.rb', line 7 def index @carrier_types = CarrierType.order(:position).page(params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @carrier_types } end end |
#new ⇒ Object
GET /carrier_types/new GET /carrier_types/new.json
27 28 29 30 31 32 33 34 |
# File 'app/controllers/carrier_types_controller.rb', line 27 def new @carrier_type = CarrierType.new respond_to do |format| format.html # new.html.erb format.json { render json: @carrier_type } end end |
#show ⇒ Object
GET /carrier_types/1 GET /carrier_types/1.json
18 19 20 21 22 23 |
# File 'app/controllers/carrier_types_controller.rb', line 18 def show respond_to do |format| format.html # show.html.erb format.json { render json: @carrier_type } end end |
#update ⇒ Object
PUT /carrier_types/1 PUT /carrier_types/1.json
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/controllers/carrier_types_controller.rb', line 59 def update if params[:move] move_position(@carrier_type, params[:move]) return end respond_to do |format| if @carrier_type.update_attributes(carrier_type_params) format.html { redirect_to @carrier_type, notice: t('controller.successfully_updated', model: t('activerecord.models.carrier_type')) } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @carrier_type.errors, status: :unprocessable_entity } end end end |