Skip to content

Instantly share code, notes, and snippets.

@esparkman
Created May 30, 2013 14:32
Show Gist options
  • Save esparkman/5678283 to your computer and use it in GitHub Desktop.
Save esparkman/5678283 to your computer and use it in GitHub Desktop.
# before this block there is an if condition to make sure it is an AR instance
# it is all being wrapped in an Array and has (approvables being passed in)
# then iterated over to give us approvable
ActiveRecord::Base.transaction do
approvable.build(:previously_approved => true)
approvable.build(:approved_at => Time.zone.now)
approvable.build(:approved_by_id => approved.try(:id))
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment