Class: IWonder::ReportsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- IWonder::ReportsController
- Defined in:
- app/controllers/i_wonder/reports_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
36 37 38 39 40 41 42 43 44 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 36 def create @report = Report.new(params[:report]) if @report.save redirect_to @report, :notice => "Successfully created report" else render "new" end end |
#destroy ⇒ Object
61 62 63 64 65 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 61 def destroy @report = Report.find(params[:id]) @report.destroy redirect_to reports_path, :notice => "Report has been destroyed" end |
#edit ⇒ Object
46 47 48 49 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 46 def edit @report = Report.find(params[:id]) render "edit" end |
#index ⇒ Object
9 10 11 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 9 def index @reports = Report.all end |
#new ⇒ Object
32 33 34 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 32 def new @report = Report.new(params[:report]) end |
#show ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 13 def show @report = Report.find(params[:id]) @start_time = (params[:start_time] ? Time.zone.parse(params[:start_time]) : Time.zone.now - 1.month) @end_time = (params[:end_time] ? Time.zone.parse(params[:end_time]) : Time.zone.now) @interval_length = default_interval_length respond_to {|format| format.html { } format.js { if @report.line? render :partial => "line_report.js" else render :text => "?" end } } end |
#update ⇒ Object
51 52 53 54 55 56 57 58 59 |
# File 'app/controllers/i_wonder/reports_controller.rb', line 51 def update @report = Report.find(params[:id]) if @report.update_attributes(params[:report]) redirect_to @report, :notice => "Successfully updated report" else render "edit" end end |