Class: Newsletter::DesignsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Newsletter::DesignsController
- Includes:
- DeleteableActions
- Defined in:
- app/controllers/newsletter/designs_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods included from DeleteableActions
Instance Method Details
#create ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/newsletter/designs_controller.rb', line 24 def create @design = Design.new(params[:design]) if @design.save flash[:notice] = 'Design was successfully created.' redirect_to(edit_design_path(@design)) else render :action => "new" end end |
#destroy ⇒ Object
43 44 45 46 |
# File 'app/controllers/newsletter/designs_controller.rb', line 43 def destroy @design.delete redirect_to(designs_url) end |
#edit ⇒ Object
21 22 |
# File 'app/controllers/newsletter/designs_controller.rb', line 21 def edit end |
#index ⇒ Object
8 9 10 11 |
# File 'app/controllers/newsletter/designs_controller.rb', line 8 def index @designs = Design.order(:name).paginate(page: (params[:page] || 1), per_page: (params[:per_page] || 30)) end |
#new ⇒ Object
17 18 19 |
# File 'app/controllers/newsletter/designs_controller.rb', line 17 def new @design = Design.new end |
#show ⇒ Object
13 14 15 |
# File 'app/controllers/newsletter/designs_controller.rb', line 13 def show @areas = @design.areas.active end |
#update ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'app/controllers/newsletter/designs_controller.rb', line 34 def update if @design.update_attributes(params[:design]) flash[:notice] = 'Design was successfully updated.' redirect_to(edit_design_path(@design)) else render :action => "edit" end end |