我有一堂课,Page
. 我想打电话page.next_page
,甚至page.page
想得到下一页。当我创建一个新Page
页面时,我想将我的最后一页关联到Book
我创建next_page
的新页面中Page
。
class AddNextPageToPages < ActiveRecord::Migration
def change
add_column :pages, :page, :references
end
end
此迁移失败。
```
-- add_column(:pages, :next_page, {:class_name=>"Page"})
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `to_sym' for {:class_name=>"Page"}:Hash/Users/username/.rvm/gems/ruby-1.9.3-p327/gems/activerecord-3.2.12/lib/active_record/connection_adapters/sqlite_adapter.rb:395:in `valid_alter_table_options'
```