Skip to content

Instantly share code, notes, and snippets.

@bookwyrm
Created October 31, 2015 13:24
Show Gist options
  • Save bookwyrm/37cf7d7fad4d5c25bac9 to your computer and use it in GitHub Desktop.
Save bookwyrm/37cf7d7fad4d5c25bac9 to your computer and use it in GitHub Desktop.
class ReportsController < ApplicationController
include Trailblazer::Operation::Controller
def create
run Report::Create do |op|
flash[:notice] = "Created Report for \"#{op.work_scope_report.title}\""
return redirect_to work_scope_report_path(op.work_scope_report)
end
@wsr = WorkScopeReport.find(params[:work_scope_report_id])
render :new
end
private
# Merge in current user
def process_params!(params)
params[:current_user] = current_user
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment