I'm fairly new to all things ruby. Working through padrino blog
tutorial using sequel (3.30), mysql2 and padrino 0.10.5
In a migration to add account_id to Post I have the following
class AddAccountToPost < Sequel::Migration
def up
alter_table :posts do
add_column :account_id, Integer
end
#and assigns a user to all existing posts
first_account = Account.first
Post.all.each { |p| p.update(:account_id => first_account.id)}
end
def down
alter_table :posts do
drop_column :account_id
end
end
end
The first part of the up migration add_column succeeds, but the second
part of assigning an user account to all existing posts fails with
rake message: "method account_id= doesn't exist"
If I log on the padrino console the code
first_account = Account.first
Post.all.each { |p| p.update(:account_id => first_account.id)}
executes without errors, it works.
What is wrong here, please?
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.