Closed stephensilber closed 11 years ago
The only place .get is called in the DBF code is when trying to read a memo field. I'm guessing you are using a dbf file that should have a memo file, but the memo file is missing. Could that be the case?
On Sat, Jun 22, 2013 at 8:47 PM, Stephen Silber notifications@github.comwrote:
I have written a rake task to import from a dbf file into my current rails application but have run into a strange bug.
desc "Import brothers" task :import_brothers => :environment do bro_db = DBF::Table.new("bro.dbf") bros = bro_db.find(:all)
bros.each do |brother| b = Brother.new b.last_name = brother["L_NAME"] unless brother["L_NAME"].nil?
I receive the error undefined method `get' for nil:NilClass
The strange part is that I can p bros.first and see that there is a column named L_NAME and I created a fresh rails project with the same gemfile and same schema for "brother" and it ran fine. Any ideas?
— Reply to this email directly or view it on GitHubhttps://github.com/infused/dbf/issues/54 .
That sounds likely, could you possibly elaborate a little bit on how I can fix this situation? I don't regularly work with DBF but it's the only format my database is available in
The memo file should be the same name as the dbf file, but with an extension of .dbt or .fpt instead of .dbf. Make sure the file is in the same directory with the .dbf file.
On Sat, Jun 22, 2013 at 10:50 PM, Stephen Silber notifications@github.comwrote:
That sounds likely, could you possibly elaborate a little bit on how I can fix this situation? I don't regularly work with DBF but it's the only format my database is available in
— Reply to this email directly or view it on GitHubhttps://github.com/infused/dbf/issues/54#issuecomment-19869517 .
I just released v2.0.4 which forces memo fields to return nil if the memo file is missing.
Very helpful, thank you so much!
I have written a rake task to import from a dbf file into my current rails application but have run into a strange bug.
I receive the error
undefined method
get' for nil:NilClass`The strange part is that I can p bros.first and see that there is a column named L_NAME and I created a fresh rails project with the same gemfile and same schema for "brother" and it ran fine. Any ideas?