Hi,

I am a beginner with ruby, i tried to use lightcsv but i have a problem
when i use a .csv file

ERROR
-------------------------------------------
/file2.rb:114:in `title=': undefined method `[]=' for nil:NilClass
(NoMethodError)
  from file1.rb:19:in `publish_post'
  from file1.rb:51
  from /Library/Ruby/Gems/1.8/gems/lightcsv-0.2.2/lib/lightcsv.rb:142:in
`each'
  from /Library/Ruby/Gems/1.8/gems/lightcsv-0.2.2/lib/lightcsv.rb:51:in
`foreach'
  from /Library/Ruby/Gems/1.8/gems/lightcsv-0.2.2/lib/lightcsv.rb:82:in
`call'
  from /Library/Ruby/Gems/1.8/gems/lightcsv-0.2.2/lib/lightcsv.rb:82:in
`open'
  from /Library/Ruby/Gems/1.8/gems/lightcsv-0.2.2/lib/lightcsv.rb:50:in
`foreach'
  from file1.rb:48
-------------------------------------------


files concerned:

file1.rb
-------------------------------------------
LightCsv.foreach(config) do|row|
            begin
                post = MyClass.new(row[0], row[1], row[2])
                [...]
            end
        end
-------------------------------------------


file2.rb
-------------------------------------------
if real.is_a? String
[...]
else
      define_method("#{key}=") do |value|
            @form[real] = value
       end
end
-------------------------------------------

if i replace row in file1.rb by row = [data1, data2, data3] it works

If someone can help me :D

-- 
Posted via http://www.ruby-forum.com/.