I want to import data into an sqlite3 db, but am fuzzy as to how to declare variables to get that done. For: :name => name Both of the above need to be initialized or defined somehow, but I don''t know how. thufir@arrakis ~/goodfellow-tool/db $ thufir@arrakis ~/goodfellow-tool/db $ ruby import.rb ["one"] import.rb:11: undefined local variable or method `name'' for main:Object (NameError) from /usr/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/ faster_csv.rb:1458:in `each'' from /usr/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/ faster_csv.rb:1003:in `foreach'' from /usr/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/ faster_csv.rb:1175:in `open'' from /usr/lib/ruby/gems/1.8/gems/fastercsv-1.2.3/lib/ faster_csv.rb:1002:in `foreach'' from import.rb:8 thufir@arrakis ~/goodfellow-tool/db $ thufir@arrakis ~/goodfellow-tool/db $ cat import.rb require ''rubygems'' require ''fastercsv'' require ''/home/thufir/goodfellow-tool/config/environment.rb'' infile = "data.csv" FCSV.foreach(infile) do |row| p row Call.new( :name => name ) end thufir@arrakis ~/goodfellow-tool/db $ thufir@arrakis ~/goodfellow-tool/db $ sqlite3 development.sqlite3 SQLite version 3.4.1 Enter ".help" for instructions sqlite> .schema CREATE TABLE calls ("id" INTEGER PRIMARY KEY NOT NULL, "name" varchar (255) DEFAULT NULL); CREATE TABLE schema_info (version integer); sqlite> sqlite> SELECT * FROM calls; 1|zero sqlite> .quit thufir@arrakis ~/goodfellow-tool/db $ thufir@arrakis ~/goodfellow-tool/db $ cat data.csv "one" "two" "three" thufir@arrakis ~/goodfellow-tool/db $ thanks, Thufir --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---