Class: MechanizeStore::OrderStatusesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MechanizeStore::OrderStatusesController
- Defined in:
- app/controllers/mechanize_store/order_statuses_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
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 28 def create @order_status = OrderStatus.new(order_status_params) respond_with @order_status do |format| if @order_status.save format.html do flash[:notice] = I18n.t(:created, model: I18n.t(:order_status, scope: "activerecord.models")) redirect_to @order_status end else format.html { render action: "new" } end end end |
#destroy ⇒ Object
58 59 60 61 62 63 64 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 58 def destroy @order_status = OrderStatus.find(params[:id]) flash[:alert] = I18n.t(:deleted, model: I18n.t(:order_status, scope: "activerecord.models")) if @order_status.destroy respond_with @order_status, :location => order_statuses_url end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 24 def edit respond_with @order_status end |
#index ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 7 def index @search = OrderStatus.search(params[:q]) @order_statuses = @search.result.paginate(page: params[:page]) respond_with @order_statuses end |
#new ⇒ Object
19 20 21 22 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 19 def new @order_status = OrderStatus.new respond_with @order_status end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 15 def show respond_with @order_status end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/mechanize_store/order_statuses_controller.rb', line 43 def update @order_status = OrderStatus.find(params[:id]) respond_with @order_status do |format| if @order_status.update(order_status_params) format.html do flash[:notice] = I18n.t(:updated, model: I18n.t(:order_status, scope: "activerecord.models")) redirect_to @order_status end else format.html { render action: "edit" } end end end |