mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-31 22:38:49 +01:00
Fix code formatting in AddStateToContext migration
This commit is contained in:
parent
560f2ff538
commit
257b969aff
1 changed files with 8 additions and 5 deletions
|
|
@ -7,16 +7,19 @@ class AddStateToContext < ActiveRecord::Migration
|
|||
add_column :contexts, :state, :string, :limit => 20, :null => false, :default => 'active'
|
||||
Context.reset_column_information
|
||||
Context.all.each do |c|
|
||||
c.state = c.hide ? 'hidden' : 'active'
|
||||
c.save!
|
||||
c.state = c.hide ? 'hidden' : 'active'
|
||||
c.save!
|
||||
end
|
||||
remove_column :contexts, :hide
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :contexts, :hide, :boolean, :default => false
|
||||
add_column :contexts, :hide, :boolean, :default => false
|
||||
Context.reset_column_information
|
||||
Context.all.each { |c| c.hide = ( c.state == 'hidden' ); c.save! }
|
||||
remove_column :contexts, :state
|
||||
Context.all.each do |c|
|
||||
c.hide = ( c.state == 'hidden' )
|
||||
c.save!
|
||||
end
|
||||
remove_column :contexts, :state
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue