2 つの単純なモデルがあります。
class Idea << ActiveRecord::Base
has_many :tasks
# for nesting....
accepts_nested_attributes_for for :tasks
attribute_accessible :tasks_attributes
end
class Task << ActiveRecord::Base
belongs_to :idea
validates_presence_of :idea # this line is causing pain
end
次の JSON を送信して、IdeasController を作成します。
{
"description":"Test test test",
"tasks":[{"description":"test test test"}]
}
...そして、検証エラーが返されます。検証を削除するとすぐに、すべてがうまくいきます!
助言がありますか?