'Attempt to call private method' error when trying to change change case of db entires in migration
- by Senthil
class AddTitleToPosts < ActiveRecord::Migration
def self.up
add_column :posts, :title, :string
Post.find(:all).each do |post|
post.update(:title => post.name.upcase)
end
end
def self.down
end
end
Like you can nothing particularly complicated, just trying to add new column title by changing case of name column already in db. But I get attempt to call private method error. I'm guessing it has something to do with 'self'?
Thanks for your help.