Class: MechanizeStore::ProductSectionsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- MechanizeStore::ProductSectionsController
- Defined in:
- app/controllers/mechanize_store/product_sections_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/product_sections_controller.rb', line 28 def create @product_section = ProductSection.new(product_section_params) respond_with @product_section do |format| if @product_section.save format.html do flash[:notice] = I18n.t(:created, model: I18n.t(:product_section, scope: "activerecord.models")) redirect_to @product_section end else format.html { render action: "new" } end end end |
#destroy ⇒ Object
58 59 60 61 62 63 64 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 58 def destroy @product_section = ProductSection.find(params[:id]) flash[:alert] = I18n.t(:removed, model: I18n.t(:product_section, scope: "activerecord.models")) if @product_section.destroy respond_with @product_section, :location => product_sections_url end |
#edit ⇒ Object
24 25 26 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 24 def edit respond_with @product_section end |
#index ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 7 def index @search = ProductSection.search(params[:q]) @product_sections = @search.result.paginate(page: params[:page]) respond_with @product_sections end |
#new ⇒ Object
19 20 21 22 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 19 def new @product_section = ProductSection.new respond_with @product_section end |
#show ⇒ Object
15 16 17 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 15 def show respond_with @product_section end |
#update ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'app/controllers/mechanize_store/product_sections_controller.rb', line 43 def update @product_section = ProductSection.find(params[:id]) respond_with @product_section do |format| if @product_section.update(product_section_params) format.html do flash[:notice] = I18n.t(:updated, model: I18n.t(:product_section, scope: "activerecord.models")) redirect_to @product_section end else format.html { render action: "edit" } end end end |