Class: Cmtool::QuotesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Cmtool::QuotesController
- Defined in:
- app/controllers/cmtool/quotes_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /quotes POST /quotes.xml.
-
#destroy ⇒ Object
DELETE /quotes/1 DELETE /quotes/1.xml.
-
#edit ⇒ Object
GET /quotes/1/edit.
-
#index ⇒ Object
GET /quotes GET /quotes.xml.
-
#new ⇒ Object
GET /quotes/new GET /quotes/new.xml.
- #remove_image ⇒ Object
-
#show ⇒ Object
GET /quotes/1 GET /quotes/1.xml.
-
#update ⇒ Object
PUT /quotes/1 PUT /quotes/1.xml.
Methods included from ControllerGlue
Instance Method Details
#create ⇒ Object
POST /quotes POST /quotes.xml
43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 43 def create @quote = Cmtool::Quote.new(params[:quote]) respond_to do |format| if @quote.save format.html { redirect_to([cmtool, @quote], :notice => I18n.t('cmtool.action.create.successful', :model => Cmtool::Quote.model_name.human)) } format.xml { render :xml => @quote, :status => :created, :location => @quote } else format.html { render :action => "new" } format.xml { render :xml => @quote.errors, :status => :unprocessable_entity } end end end |
#destroy ⇒ Object
DELETE /quotes/1 DELETE /quotes/1.xml
75 76 77 78 79 80 81 82 83 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 75 def destroy @quote = Cmtool::Quote.find(params[:id]) @quote.destroy respond_to do |format| format.html { redirect_to(cmtool.quotes_url, notice: I18n.t('cmtool.action.destroy.successful', model: Cmtool::Quote.model_name.human)) } format.xml { head :ok } end end |
#edit ⇒ Object
GET /quotes/1/edit
37 38 39 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 37 def edit @quote = Cmtool::Quote.find(params[:id]) end |
#index ⇒ Object
GET /quotes GET /quotes.xml
5 6 7 8 9 10 11 12 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 5 def index @quotes = Cmtool::Quote.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @quotes } end end |
#new ⇒ Object
GET /quotes/new GET /quotes/new.xml
27 28 29 30 31 32 33 34 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 27 def new @quote = Cmtool::Quote.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @quote } end end |
#remove_image ⇒ Object
84 85 86 87 88 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 84 def remove_image @quote = Cmtool::Quote.find(params[:id]) @quote.image = nil @quote.save end |
#show ⇒ Object
GET /quotes/1 GET /quotes/1.xml
16 17 18 19 20 21 22 23 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 16 def show @quote = Cmtool::Quote.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @quote } end end |
#update ⇒ Object
PUT /quotes/1 PUT /quotes/1.xml
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'app/controllers/cmtool/quotes_controller.rb', line 59 def update @quote = Cmtool::Quote.find(params[:id]) respond_to do |format| if @quote.update_attributes(params[:quote]) format.html { redirect_to([cmtool, @quote], :notice => I18n.t('cmtool.action.update.successful', :model => Cmtool::Quote.model_name.human)) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @quote.errors, :status => :unprocessable_entity } end end end |