'Attempt to call private method' error when trying to change change case of db entires in migration
Posted
by Senthil
on Stack Overflow
See other posts from Stack Overflow
or by Senthil
Published on 2010-04-24T04:28:30Z
Indexed on
2010/04/24
4:33 UTC
Read the original article
Hit count: 297
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.
© Stack Overflow or respective owner