forked from railsbridge/bridge_troll
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure event.draft_saved is 'false' instead of 'nil'
Fixes railsbridge#366
- Loading branch information
1 parent
e02c947
commit 155c852
Showing
2 changed files
with
16 additions
and
2 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
db/migrate/20150813035954_ensure_draft_saved_is_false_instead_of_nil.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
class EnsureDraftSavedIsFalseInsteadOfNil < ActiveRecord::Migration | ||
class Event < ActiveRecord::Base; end | ||
|
||
def up | ||
change_column_default :events, :draft_saved, false | ||
Event.find_each do |e| | ||
e.update_attribute(:draft_saved, false) if e.draft_saved.nil? | ||
end | ||
end | ||
|
||
def down | ||
change_column_default :events, :draft_saved, nil | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters