reports.rb
def method
if self.name == "Maintenance History"
'maintenance_history'
elsif self.name == "Outstanding Maintenance"
'outstanding_maintenance'
elsif self.name == "Idle Time Report"
'idle_time_report'
end
end
def maintenance_history
maintenance_history.where(....)
end
def outstanding_maintenance
outstanding_maintenance.where(....)
end
def idle_time_report
idle_time_report.where(....)
end
reports_controller
def show
@report = Report.find(params[:id])
respond_to do |format|
format.html # show.html.erb
show.html.haml
= render @report.method, :report => @report
I would like to format the html table in my view with the following tag %table.table.datatable#datatable
This:
%table.table.datatable#datatable
= render @report.method, :report => @report
does not work...