forked from lagotto/lagotto
-
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.
Remove default value for state from sources table, to fix problem wit…
…h statemachine See this page for more information: pluginaweek/state_machine#279
- Loading branch information
Showing
2 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
db/migrate/20131105105631_remove_state_default_from_sources.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,11 @@ | ||
class RemoveStateDefaultFromSources < ActiveRecord::Migration | ||
def up | ||
# Remove default from state column as this causes an error to be thrown: "Both Source and its :state machine have defined a different default for "state". Use only one or the other for defining defaults to avoid unexpected behaviors." | ||
# See this page for more information: https://github.com/pluginaweek/state_machine/issues/279 | ||
change_column_default(:sources, :state, nil) | ||
end | ||
|
||
def down | ||
change_column_default(:sources, :state, 0) | ||
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