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

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

  • Michael Pavling at Oct 10, 2011 at 5:40 am

    On 10 October 2011 04:59, slava wrote:
    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?

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
  • Robert Walker at Oct 10, 2011 at 6:09 am

    Slava Mikerin wrote in post #1025868:
    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

    Loading development environment (Rails 3.1.1)
    ruby-1.9.2-p290 :001 > "fish".pluralize
    => "fish"
    ruby-1.9.2-p290 :002 > "sheep".pluralize
    => "sheep"
    ruby-1.9.2-p290 :003 > "trade_terms".pluralize
    => "trade_terms"
    ruby-1.9.2-p290 :004 > "trade_terms".singularize
    => "trade_terms"

    --
    Posted via http://www.ruby-forum.com/.

    --
    You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
    To post to this group, send email to rubyonrails-talk@googlegroups.com.
    To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedOct 10, '11 at 3:59a
activeOct 10, '11 at 6:09a
posts3
users3
websiterubyonrails.org
irc#RubyOnRails

People

Translate

site design / logo © 2022 Grokbase