我遇到了一個問題,最近使用ActiveRecord
放置在一個表上。這是最初的遷移創建表:Post.create方法不正確的參數個數(3爲2)
class CreatePosts < ActiveRecord::Migration
def change
create_table :posts do |t|
t.string :title
t.text :content
t.timestamps
end
end
end
我添加一個字段,它後來與此遷移:
class AddPrivateToPosts < ActiveRecord::Migration
def change
add_column :posts, :private, :boolean
end
end
每當我打電話Post.create("Title", "Content", true)
或Post.create!("Title", "Content", true)
,我得到too many arguments
錯誤。任何人都可以幫助我嗎?
這個工作。謝謝 - 不知道這是rails語法的一部分。 – Nick