How to specify a polymorphic association in a fixture
I have this fixture:
resource:
name: my resource
owner: user_1 (User)
Resource is defined like this:
class Resource < ActiveRecord::Base
belongs_to :owner, :polymorphic => true
User is defined like this:
class User < ActiveRecord::Base
has_many :resources, :as => :owner
When I run the test I get an error tha开发者_开发问答t the column 'owner' is not defined in the table. What am I doing wrong?
The fixture should have owner_id and owner_type. For example: owner_id as 1 and owner_type as "User"
精彩评论