ruby on rails - ActiveRecord::Fixture::FixtureError: table "posts" has no column named "user" - where a 'post' belongs_to 'user' -
i trying create association tests class belongs_to association.
the test fails when fixtures being created - rails not detecting belongs_to :user association in posts.
it seems pass in regular rake test command, not when individual file ran inside guard.
the test below:
module post class associationstest < activesupport::testcase subject { post.new } should belong_to(:user) end end
i managed figure out issue - think because using nested module/class definitions test, , using same module name.
the working code was:
class post::associationstest < activesupport::testcase subject { post.new } should belong_to(:user) end
Comments
Post a Comment