In MongoDB integration tests ( test/models/mongoid_models.rbhttps://github.com/karmi/tire/blob/master/test/models/mongoid_models.rb)are shown some
referenced 1-n http://mongoid.org/en/mongoid/docs/relations.html#has_manymongoid relations.
Is that applicable to embedded 1-nhttp://mongoid.org/en/mongoid/docs/relations.html#embeds_manyrelations too out of the box, or some more tricks are needed ?
Is that possible to extend test/models/mongoid_models.rbhttps://github.com/karmi/tire/blob/master/test/models/mongoid_models.rbwith embeds_many
/ embedded_in example models ?
I tried doing the following:
class User
include Mongoid::Document
include Tire::Model::Search
include Tire::Model::Callbacks
tire do
mapping do
indexes :nickname
indexes :watchlists do
indexes :description
indexes :html_url
indexes :tags
end
end
end
def to_indexed_json
{
:nickname => nickname,
:watchlists => watchlists.map { |c| { :_type => 'mongoid_watchlist',
:_id => c.id,
:description => c.description,
:html_url => c.html_url,
:tags => c.tags } }
}.to_json
end
field :nickname
embeds_many :watchlists
end
class Watchlist
include Mongoid::Document
field :description
field :html_url
field :tags
embedded_in :user
end
but then, running tire:import, it seems never ending :
RAILS_ENV=production rake environment tire:import CLASS=User FORCE=true
--