hello,
I have a problem with a migration sequence. Running rake db:migrate from
the start (empty db) fails at migration 20. The problem it appears, is
that the new attributes are not reloaded. I have tried adding "load
‘state.rb’ to the migration but this also fails.
If i run the migration again from the failed point it succeeds.
i would like to be able to run the complete set of migrations to create
the db.
Thanks in advance for any help.
Error:
== RePopulateStates: migrating
rake aborted!
undefined method page_name=' for #<State:0x355f728> /Users/adam/Projects/boomkat/acquire.boomkat.com/trunk/vendor/rails/activerecord/lib/active_record/base.rb:1934:in
method_missing’
/Users/adam/Projects/boomkat/acquire.boomkat.com/trunk/vendor/rails/activerecord/lib/active_record/base.rb:1749:in
send' /Users/adam/Projects/boomkat/acquire.boomkat.com/trunk/vendor/rails/activerecord/lib/active_record/base.rb:1749:in
attributes=’
migration 19) The first migration adds 4 columns.
eg
add_column :states, :page_name, :string, :default => ''
add_column :states, :body_class, :string, :default => ''
add_column :states, :path, :string, :default => ''
migration 20) The second clears out the model and repopulates:
eg
State.destroy_all
State.create!(:name => ‘received’, :page_name => ‘Inbox’,
:body_class => ‘inbox’, :path=> ‘releases_path’,
:empty_text => ‘No releases have have imported at this time.’)
State.create!(:name => 'accepted', :page_name => 'Edit and
Publish’, :body_class => ‘edit_and_publish’, :path=>
‘publish_releases_path’, :empty_text => ‘No releases have have
completed publication at this time.’)