0

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?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Luiz E.
  • 6,769
  • 10
  • 58
  • 98
  • anyone? tried remove the line `inflect.irregular 'noticia', 'noticias'`, but didn't worked too – Luiz E. May 06 '12 at 23:37
  • 1
    I gave it a try, and things work for me. I did notice that the inflect did not take effect if I put it after Application.initialize! in environment.rb. Where did you put it? Can you reproduce your problem locally, with noticia --> noticia? I did not try on heroku yet, as I was able to get noticia --> noticias to inflect locally. Test code is available on request. – Gary Murakami May 09 '12 at 20:46
  • yup, you were right. put right before `Application.initialize!` did the trick – Luiz E. May 10 '12 at 00:24

1 Answers1

1

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

Gary Murakami
  • 3,392
  • 1
  • 16
  • 20