Hi,
I have a model with a user and many of his drives.
class User < ActiveRecord::Base
has_many :drives
end
class Drive < ActiveRecord:: Base
belongs_to :user
end
Now when I want to add another drive to the user like so:
drive = Drive.new() # ... user = user.find(x) user.drives
<< drive
This will create this error:
NameError: uninitialized constant User::Drife
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/
dependencies.rb:105:in const_missing'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ba
se.rb:2204:in compute_type'
from /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/
core_ext/kernel/reporting.rb:11:in
silence_warnings'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/ba
se.rb:2200:in compute_type'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/re
flection.rb:156:in send'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/re
flection.rb:156:in klass'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/re
flection.rb:187:in quoted_table_name'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/as
sociations/has_many_association.rb:96:in
construct_sql'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/as
sociations/association_collection.rb:21:in
initialize'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/as
sociations.rb:1277:in new'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/as
sociations.rb:1277:in drives'
from (irb):3