I have a model like this
class Canvas
include Mongoid::Document
field :name
referenced_in :hero
end
class Browser < Canvas
field :version, :type => Integer
end
class Hero
include Mongoid::Document
field :name
references_many :canvases
end
How can I build Brower Object refered from Hero object.
All i want to do is
h = Hero.create!({:name => 'Aston'})
h.browsers.build
However it gave me an error
undefined method `browsers' for #<Hero _id: 4d92c8fc1426960fff000005, name: "Aston">
Am i missing something?
Thanks