Hello everybody... i was trying update my application from 2.3.5 (yes... i know, very old) to 3.2. as we know, many changes occurred during that time and i don''t know if this ploblem is a know problem or other rule of pluralization... well i really don''t know how to solve this. two models Class Department < ActiveRecord::Base ... has_many :waves ... end Class Wave < ActiveRecord::Base ... belongs_to :department ... end Department.find(x).waves explode this... uninitialized constant Department::Wafe /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/gems/ activerecord-3.2.0/lib/active_record/inheritance.rb:119:in `compute_type'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/reflection.rb:172:in `klass'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/associations/association.rb: 117:in `klass'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/associations/association.rb: 165:in `find_target?'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/associations/ collection_association.rb:332:in `load_target'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/associations/ collection_proxy.rb:44:in `load_target'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/activerecord-3.2.0/lib/active_record/associations/ collection_proxy.rb:88:in `method_missing'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `block in determine_output_class'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `each'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `any?'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `determine_output_class'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/formatter.rb:53:in `format_output'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/view.rb:204:in `render_output'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/view.rb:123:in `view_output'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/view.rb:200:in `view_or_page_output'' /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ gems/hirb-0.6.0/lib/hirb/view.rb:186:in `output_value'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ irb.rb:160:in `block (2 levels) in eval_input'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ irb.rb:273:in `signal_status'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ irb.rb:156:in `block in eval_input'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ ruby-lex.rb:229:in `loop'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ ruby-lex.rb:229:in `block in each_top_level_statement'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ ruby-lex.rb:228:in `catch'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ ruby-lex.rb:228:in `each_top_level_statement'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ irb.rb:155:in `eval_input'' /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ irb.rb:70:in `block in start'' i can find Wave.find(x).department. why of this? uninitialized constant Department::Wafe Thanks in advance for answers... -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 23, 3:10 am, Murilo Urban Monteiro <muriloumonte...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > i can find Wave.find(x).department. > > why of this? uninitialized constant Department::Wafe >I think the inflection rules changed somewhere around 3.0, so when rails tries to depluralize :waves, it gets ''wafe'' and so looks for a class of that name. You should be able to override that inflection rule by doing something like ActiveSupport::Inflector.inflections do |inflect| inflect.irregular ''wave'', ''waves'' end in an initializer Fred -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org 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.
On Mon, Jan 23, 2012 at 6:02 PM, Frederick Cheung < frederick.cheung-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On Jan 23, 3:10 am, Murilo Urban Monteiro <muriloumonte...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > i can find Wave.find(x).department. > > > > why of this? uninitialized constant Department::Wafe > > > > I think the inflection rules changed somewhere around 3.0, so when > rails tries to depluralize :waves, it gets ''wafe'' and so looks for a > class of that name. > > You should be able to override that inflection rule by doing something > like > > ActiveSupport::Inflector.inflections do |inflect| > inflect.irregular ''wave'', ''waves'' > end > > in an initializer > > To add more to what Fred said, you should already have an initializerwhich is specifically for this purpose, look for config/initializers/inflections.rb file Chirag http://sumeruonrails.com> Fred > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Mon, Jan 23, 2012 at 4:10 AM, Murilo Urban Monteiro < muriloumonteiro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hello everybody... > > i was trying update my application from 2.3.5 (yes... i know, very > old) to 3.2. > > as we know, many changes occurred during that time and i don''t know if > this ploblem is a know problem or other rule of pluralization... well > i really don''t know how to solve this. > > two models > > Class Department < ActiveRecord::Base > ... > has_many :waves > ... > end > > Class Wave < ActiveRecord::Base > ... > belongs_to :department > ... > end > > Department.find(x).waves > > explode this... > > uninitialized constant Department::Wafe > > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/gems/ > activerecord-3.2.0/lib/active_record/inheritance.rb:119:in > `compute_type'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/reflection.rb:172:in `klass'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/associations/association.rb: > 117:in `klass'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/associations/association.rb: > 165:in `find_target?'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/associations/ > collection_association.rb:332:in `load_target'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/associations/ > collection_proxy.rb:44:in `load_target'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/activerecord-3.2.0/lib/active_record/associations/ > collection_proxy.rb:88:in `method_missing'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `block in > determine_output_class'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `each'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `any?'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `determine_output_class'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/formatter.rb:53:in `format_output'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/view.rb:204:in `render_output'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/view.rb:123:in `view_output'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/view.rb:200:in `view_or_page_output'' > /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ > gems/hirb-0.6.0/lib/hirb/view.rb:186:in `output_value'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ > irb.rb:160:in `block (2 levels) in eval_input'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ > irb.rb:273:in `signal_status'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ > irb.rb:156:in `block in eval_input'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ > ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ > ruby-lex.rb:229:in `loop'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ > ruby-lex.rb:229:in `block in each_top_level_statement'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ > ruby-lex.rb:228:in `catch'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ > ruby-lex.rb:228:in `each_top_level_statement'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ > irb.rb:155:in `eval_input'' > /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ > irb.rb:70:in `block in start'' > > i can find Wave.find(x).department. > > why of this? uninitialized constant Department::Wafe > > Thanks in advance for answers... >Root cause is probably related to: 1.9.3p0 :002 > "Waves".singularize => "Wafe" Fix that first in config/initializers/inflections.rb When the problem persists, we can look further. HTH, Peter -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks Fred, Chirag and Peter. I wrote the following code inside the inflections: ActiveSupport::Inflector. inflections do |inflect| inflect.irregular ''wave'', ''waves'' end and "waves".singularize return "waves" this was the cause of the problem. Thnks again. 2012/1/23 Peter Vandenabeele <peter-jNuWw7i2w7syMbTcgqFhxg@public.gmane.org>> On Mon, Jan 23, 2012 at 4:10 AM, Murilo Urban Monteiro < > muriloumonteiro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> Hello everybody... >> >> i was trying update my application from 2.3.5 (yes... i know, very >> old) to 3.2. >> >> as we know, many changes occurred during that time and i don''t know if >> this ploblem is a know problem or other rule of pluralization... well >> i really don''t know how to solve this. >> >> two models >> >> Class Department < ActiveRecord::Base >> ... >> has_many :waves >> ... >> end >> >> Class Wave < ActiveRecord::Base >> ... >> belongs_to :department >> ... >> end >> >> Department.find(x).waves >> >> explode this... >> >> uninitialized constant Department::Wafe >> >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/gems/ >> activerecord-3.2.0/lib/active_record/inheritance.rb:119:in >> `compute_type'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/reflection.rb:172:in `klass'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/associations/association.rb: >> 117:in `klass'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/associations/association.rb: >> 165:in `find_target?'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/associations/ >> collection_association.rb:332:in `load_target'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/associations/ >> collection_proxy.rb:44:in `load_target'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/activerecord-3.2.0/lib/active_record/associations/ >> collection_proxy.rb:88:in `method_missing'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `block in >> determine_output_class'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `each'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `any?'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `determine_output_class'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/formatter.rb:53:in `format_output'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/view.rb:204:in `render_output'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/view.rb:123:in `view_output'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/view.rb:200:in `view_or_page_output'' >> /Users/murilomonteiro/.rvm/gems/ruby-1.9.3-p0@TalentTracker3.2/ >> gems/hirb-0.6.0/lib/hirb/view.rb:186:in `output_value'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ >> irb.rb:160:in `block (2 levels) in eval_input'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ >> irb.rb:273:in `signal_status'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ >> irb.rb:156:in `block in eval_input'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ >> ruby-lex.rb:243:in `block (2 levels) in each_top_level_statement'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ >> ruby-lex.rb:229:in `loop'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ >> ruby-lex.rb:229:in `block in each_top_level_statement'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ >> ruby-lex.rb:228:in `catch'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/irb/ >> ruby-lex.rb:228:in `each_top_level_statement'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ >> irb.rb:155:in `eval_input'' >> /Users/murilomonteiro/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/ >> irb.rb:70:in `block in start'' >> >> i can find Wave.find(x).department. >> >> why of this? uninitialized constant Department::Wafe >> >> Thanks in advance for answers... >> > > > Root cause is probably related to: > > 1.9.3p0 :002 > "Waves".singularize > => "Wafe" > > Fix that first in config/initializers/inflections.rb > > When the problem persists, we can look further. > > HTH, > > Peter > > -- > 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. >-- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.