Class: Spud::Admin::PrintersController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Spud::Admin::PrintersController
- Defined in:
- app/controllers/spud/admin/printers_controller.rb
Instance Method Summary collapse
Instance Method Details
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 18 def create "New", :new_spud_admin_printer_path @printer = SpudPrinter.new(params[:spud_printer]) if @printer.save flash[:notice] = "Printer added successfully!" else flash[:error] = "Error saving printer!" end respond_with @printer,:location => spud_admin_printers_url end |
#destroy ⇒ Object
49 50 51 52 53 54 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 49 def destroy flash[:notice] = "Printer removed!" if @printer.destroy respond_with @printer,:location => spud_admin_printers_url end |
#edit ⇒ Object
32 33 34 35 36 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 32 def edit "Edit", :edit_spud_admin_printer_path respond_with @printer end |
#index ⇒ Object
7 8 9 10 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 7 def index @printers = SpudPrinter.order(:name).paginate :page => params[:page] respond_with @printers end |
#new ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 12 def new "New", :new_spud_admin_printer_path @printer = SpudPrinter.new respond_with @printer end |
#update ⇒ Object
38 39 40 41 42 43 44 45 46 47 |
# File 'app/controllers/spud/admin/printers_controller.rb', line 38 def update "Edit", :edit_spud_admin_printer_path if @printer.update_attributes(params[:spud_printer]) flash[:notice] = "Printer updated successfully!" else flash[:error] = "Error saving printer!" end respond_with @printer,:location => spud_admin_printers_url end |