Module: DcidevApproval::ClassMethods
- Defined in:
- lib/dcidev_approval.rb
Instance Method Summary collapse
Instance Method Details
#create_data(params, agent, bypass = true) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/dcidev_approval.rb', line 132 def create_data(params, agent, bypass = true) if bypass ActiveRecord::Base.transaction do data = params.merge!({ status: :approved }) d = new_from_params(data) raise d.errors..join(', ') unless d.save yield d end else d = new_from_params(params) d.status = agent.is_admin? ? :approved : :waiting raise d.errors..join(', ') unless d.save yield d end end |