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 <[email protected]>

> On Mon, Jan 23, 2012 at 4:10 AM, Murilo Urban Monteiro <
> [email protected]> 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/[email protected]/gems/
>> activerecord-3.2.0/lib/active_record/inheritance.rb:119:in
>> `compute_type'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/reflection.rb:172:in `klass'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/associations/association.rb:
>> 117:in `klass'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/associations/association.rb:
>> 165:in `find_target?'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/associations/
>> collection_association.rb:332:in `load_target'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/associations/
>> collection_proxy.rb:44:in `load_target'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/activerecord-3.2.0/lib/active_record/associations/
>> collection_proxy.rb:88:in `method_missing'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `block in
>> determine_output_class'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `each'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `any?'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/formatter.rb:87:in `determine_output_class'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/formatter.rb:53:in `format_output'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/view.rb:204:in `render_output'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/view.rb:123:in `view_output'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> gems/hirb-0.6.0/lib/hirb/view.rb:200:in `view_or_page_output'
>>    /Users/murilomonteiro/.rvm/gems/[email protected]/
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to