Class: SummariesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- SummariesController
- Defined in:
- app/controllers/summaries_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
17 18 19 20 21 22 23 24 25 |
# File 'app/controllers/summaries_controller.rb', line 17 def create @summary = summary.new(params[:summary]) if @summary.save flash[:notice] = "Successfully created summary." redirect_to @summary else render :action => 'new' end end |
#destroy ⇒ Object
41 42 43 44 45 46 |
# File 'app/controllers/summaries_controller.rb', line 41 def destroy @summary = summary.find(params[:id]) @summary.destroy flash[:notice] = "Successfully destroyed summary." redirect_to summaries_url end |
#edit ⇒ Object
27 28 29 |
# File 'app/controllers/summaries_controller.rb', line 27 def edit @summary = summary.find(params[:id]) end |
#index ⇒ Object
2 3 4 |
# File 'app/controllers/summaries_controller.rb', line 2 def index @summaries = Summary.all end |
#new ⇒ Object
12 13 14 15 |
# File 'app/controllers/summaries_controller.rb', line 12 def new @summary = Summary.new @survey = Survey.find(1) end |
#show ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/summaries_controller.rb', line 6 def show authenticate_user! @summary = summary.find(params[:id]) @summary_answer = summaryAnswer.new end |
#update ⇒ Object
31 32 33 34 35 36 37 38 39 |
# File 'app/controllers/summaries_controller.rb', line 31 def update @summary = summary.find(params[:id]) if @summary.update_attributes(params[:summary]) flash[:notice] = "Successfully updated summary." redirect_to @summary else render :action => 'edit' end end |