Class: DailyReportsController
- Inherits:
-
InheritedResources::Base
- Object
- InheritedResources::Base
- DailyReportsController
- Defined in:
- app/controllers/daily_reports_controller.rb
Instance Method Summary collapse
- #archiveit ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #generate ⇒ Object
- #unarchiveit ⇒ Object
- #update ⇒ Object
Instance Method Details
#archiveit ⇒ Object
29 30 31 32 33 34 35 36 |
# File 'app/controllers/daily_reports_controller.rb', line 29 def archiveit if @daily_report.archive flash[:notice] = "Report has been archived." else flash[:alert] = "Report has not been archived." end redirect_to daily_table_daily_report_path(@daily_report.table, @daily_report) end |
#create ⇒ Object
5 6 7 8 9 10 11 |
# File 'app/controllers/daily_reports_controller.rb', line 5 def create build_resource.user = current_user create! do |success, failure| success.all { redirect_to daily_table_daily_report_path(@daily_report.table, @daily_report)} failure.all { render :new } end end |
#destroy ⇒ Object
25 26 27 |
# File 'app/controllers/daily_reports_controller.rb', line 25 def destroy destroy! { daily_table_path(@daily_report.table) } end |
#generate ⇒ Object
20 21 22 23 |
# File 'app/controllers/daily_reports_controller.rb', line 20 def generate @daily_report.queue_now! redirect_to daily_table_daily_report_path(@daily_report.table, @daily_report) end |
#unarchiveit ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'app/controllers/daily_reports_controller.rb', line 38 def unarchiveit if @daily_report.unarchive flash[:notice] = "Report has been unarchived." else flash[:alert] = "Report has not been unarchived." end redirect_to daily_table_daily_report_path(@daily_report.table, @daily_report) end |
#update ⇒ Object
13 14 15 16 17 18 |
# File 'app/controllers/daily_reports_controller.rb', line 13 def update update! do |success, failure| success.all { redirect_to daily_table_daily_report_path(@daily_report.table, @daily_report)} failure.all { render :edit } end end |