ruby-on-railsruby-on-rails-3mongodbmongoidmongohq

mongoid creating different collections on mongohq


I have this model

class Noticia
  include Mongoid::Document
  include Mongoid::Timestamps
  include Mongoid::Slug

  belongs_to :user

  field :titulo, :type => String
  field :conteudo, :type => String
  field :tags, :type => Array

  index :tags
  slug :titulo
end

with this environment

ActiveSupport::Inflector.inflections do |inflect|
  inflect.irregular 'inscricao', 'inscricoes'
  inflect.irregular 'noticia', 'noticias'
  inflect.irregular 'central', 'centrais'
end

when I create a 'noticia' locally, it creates on collection 'noticia'. But when I create a 'noticia' on heroku, it appears on a collection called 'noticias'. plus, the notcias collection didn't have a tags field, that is really important to my app, to perform searchs on noticia

Any ideas?


Solution

  • Good to hear that putting the inflect calls before Application.initialize! fixed your problem.