Missing "[email protected]" method

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

On Apr 6, 3:14pm, “Brad T.” [email protected] wrote:

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++
the ++ operator doesn’t exist in ruby.

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs