Skip to content

Instantly share code, notes, and snippets.

@djanowski
Created June 8, 2010 23:44
Show Gist options
  • Select an option

  • Save djanowski/430810 to your computer and use it in GitHub Desktop.

Select an option

Save djanowski/430810 to your computer and use it in GitHub Desktop.
class Report
def update_tipifications(tipifications)
self.tipifications = tipifications
analizar!
save!
end
end
class ReportsController
def save
params[:report].each do |report_id, report_params|
report = Report.find(report_id)
report.priority = Priority.find(report_params[:priority_id])
report.comments.create! :comment => report_params[:comment], :user => current_user unless report_params[:comment].blank?
report.update_tipifications(report_params[:tipification_ids].map { |id| Tipification.find(id) }) unless report_params[:tipification_ids].empty?
end
redirect_to :action => 'listing'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment