Reputation: 15079
I have these models:
class Feed
include Mongoid::Document
field :name
field :host
field :user_name
...
has_many :stores
end
class Store
include Mongoid::Document
field :name
field :store_id
field :dealfeeds, type: Array
...
belongs_to :feed
end
But when I try to add a store through feeds, I get these errors:
>> Feed.stores << Store.new
NoMethodError: undefined method `stores' for Feed:Class
>> Feed[:stores] << Store.new
NoMethodError: undefined method `[]' for Feed:Class
Upvotes: 0
Views: 267
Reputation: 15079
Ah, silly me. These are operations on an instance not on a class.
Upvotes: 1