After upgrading to Rails 3.1.1 I am getting an error related to
inflections for a model - TradeTerms
This model has same name for singular and plural tenses, but this is
now not recognized and I get error:
uninitialized constant TradeTerm
I tried messing around with initializer for inflections and set rules
(not sure which one is the one to use), but it made no difference
anyway and I still get the same error…
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular ‘trade_terms’, ‘trade_terms’
inflect.plural ‘trade_terms’, ‘trade_terms’
inflect.irregular ‘trade_terms’, ‘trade_terms’
end
After upgrading to Rails 3.1.1 I am getting an error related to
inflections for a model - TradeTerms
This model has same name for singular and plural tenses, but this is
now not recognized and I get error:
uninitialized constant TradeTerm
So your singular for “trade terms” is TradeTerms, and your plural is
TradeTerms too? Don’t you think that might be a bad idea? Can the
singular not be TradeTerm?
I tried messing around with initializer for inflections and set rules
(not sure which one is the one to use), but it made no difference
anyway and I still get the same error…
ActiveSupport::Inflector.inflections do |inflect|
inflect.singular ‘trade_terms’, ‘trade_terms’
inflect.plural ‘trade_terms’, ‘trade_terms’
inflect.irregular ‘trade_terms’, ‘trade_terms’
end
If you want the same plural and singular form then you want to use
“uncountable”:
ActiveSupport::Inflector.inflections do |inflect|
inflect.uncountable %w( trade_terms )
end