Hello Richard,

In your project directory run: "rake routes".  Get used to using this
command to check that RoR agrees with what you think are valid routes.

Also, looking at your controller.index it seems that you are handing
the item list created from the csv filenames in to the index view.
The view is looking for each item's id which is nil - it doesn't get
set until the item is saved in the database.

The line in index that you have commented out should be run to
generate @csv_items.

You need to figure out how you're going to load the database before
you try to display it's contents.

Rick

On Nov 26, 4:05 pm, RichardOnRails
<[EMAIL PROTECTED]> wrote:
> A couple of blemishes on my post.  Obviously:
> The pastie hyperlink should behttp://www.pastie.org/325017
> The other hyperlink doesn't make any sense.  It's content is the third
> item on the pastie page.
>
> I apologize for seeing how things would get displayed on the
> newsgroup.  I doubt anybody will really be bothered by it.
>
> Richard
>
> On Nov 26, 8:45 pm, RichardOnRails
>
> <[EMAIL PROTECTED]> wrote:
> > 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 onhttp://www.pastie.org/325017:
> > csv_items_controller.rb
> > index.html.erb (the first .erb to 
> > complain)http://localhost:3000/csv_items(whichshows 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to