I''m working on getting some data imported to my database from a CSV
file. Here''s the code:
def import_assets(path)
r = 0
CSV.foreach(path) do |row|
r++
b = Asset.new
#populate the fields, etc
b.save
end
puts "Imported #{r} assets."
end
My other import methods worked fine for all my other models, but when I
run this one, it throws a NoMethodError on the line where I create the
new Asset, and it says there''s no "+@" method for the new
Asset. I''ve
also tried to define the method, but that doesn''t help. I''m
running
rails 3.0.5, ruby 1.9.2.
--
Posted via http://www.ruby-forum.com/.
--
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.