Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Import breaks when not using default primary key

#25

I have a model where the primary key field is NOT "id". I work on MySQL tables that have been there before me.

class Buy < ActiveRecord::Base
  set_table_name "BUY"
  set_primary_key "buy_no"
end

When I try to import an Array of new Buys i get an error :

/usr/lib/ruby/gems/1.8/gems/activerecord-2.1.2/lib/active_record/attribute_methods.rb:251:in method_missing': undefined methodbuy_no_before_type_cast' for #<Buy:0xb70739d0> (NoMethodError)

from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:174:in `send'
from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:174:in `import'
from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:173:in `each'
from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:173:in `import'
from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:168:in `each'
from /usr/lib/ruby/gems/1.8/gems/ar-extensions-0.9.1/lib/ar-extensions/import.rb:168:in `import'

the methods _before_type_cast only exist for 'ordinary' attributes
what should I do ?

Reported by DaniSchumacher · June 17th, 2009 @ 09:04 AM

State: new
Milestone: none
Assigned to: Zach Dennis Zach Dennis

Activity

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.