I’m trying to populate a table with the names and attributes of files
in public\data\csv.
The ultimate target is a currently empty Sqlite3 database which yields
the following dump:
CREATE TABLE "csv_items" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT
NULL, "filename" varchar(255), "created" date, "modified" date,
"imported" date,
"created_at" datetime, "updated_at" datetime);
Logger.info shows that I accessed the desired filenames, thanks to
this newsgroup.
I changed CsvItemsController#index as follows:
# @csv_items = CsvItem.find(:all)
@csv_items = get_csv_filenames_attributes
In def get_csv_filenames_attributes
# I populated a “values” array with the names of the files I
imported; then ...
array = []
values.each { |filename|
item = CsvItem.new
item.filename = filename
item.created = Date.new (I’ll put in real values when I get this
problem solved.
item.modified = Date.new
item.imported = Date.new
array << item
}
array
end
That seems to work, except some of the .erb’s became unhappy. So I
assume there’s something wrong with the way I populated @csv_items.
I posted the following on http://www.pastie.org/325017:
csv_items_controller.rb
index.html.erb (the first .erb to complain)
http://localhost:3000/csv_items (which shows the symptoms)
TIA,
Richard
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---