Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lynndylanhurley/c309c48685f4387f4fb6 to your computer and use it in GitHub Desktop.
Save lynndylanhurley/c309c48685f4387f4fb6 to your computer and use it in GitHub Desktop.
class AddSubmissionTimesToSubmittedApps < ActiveRecord::Migration
def change
# set all currently submitted applications submitted_at time to now
ProgramApplication.where(company: nil, ready_to_submit: true).each{|app|
unless app.company
app.company = Company.create!(name: 'unnamed')
end
app.submitted_at = Time.now
app.save!
}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment