Forum: Ruby on Rails Legacy database: help needed

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Mark S. (Guest)
on 2008-12-19 19:08
(Received via mailing list)
I am "new" to Ruby and Rails and jumping right in. That's for me the
best way to learn quickly. I am trying to do a simple project on a
legacy database. I performed the following steps:

Created a new project, then with the generator scaffold created a
simple "recipes" table.

I am coming from IBM iSeries where we have tables and so called record
formats. For example the table is named "qvvalup" and the record
format is named "qvvaluf", where the record format "handles a single
record" so to speak. So we have the same kind of concept as with the
rails pluralization: recipes and recipe.

I made copies of folders and files and renamed accordingly. A few
examples. The model file "recipe.rb" I copied to "qvvaluf.rb". And the
folder "apps/views/recipes" I copied to "apps/views/qvvalup". I have a
"qvvalup_controller.rb" and so on. Also did a search and replace in
all the files self. So "recipes" to "qvvalup" and then "recipe" to
"qvvaluf". Did put in a "map" in "routes.rb" as well:

  map.resources :qvvalup

Next step was editing my model file "qvvaluf":

  set_table_name "qvvalup"
  set_primary_key "qvqvcode"

to be able to handle the pluralization and primary key.

I am getting an error when going to localhost:3000/qvvalup. The error
seems to be in my "index.html.erb" when it is trying to create my
"show link":

undefined method `qvvaluf_path' for #<ActionView::Base:0x4953c34>

My "index.html.erb" is below and I can't find anything that I might
have forgotten to rename or whatever. Is it maybe the routing that is
going wrong here ? Or something else ? Any help appreciated...



<h1>Werken met valuta</h1>

    <th>Aantal decimalen</th>

<% for qvvaluf in @qvvalup %>
    <td><%=h qvvaluf.qvqvcode %></td>
    <td><%=h qvvaluf.qvqvomsc %></td>
    <td><%=h qvvaluf.qvqvkoer %></td>
    <td><%=h qvvaluf.qvqvaant %></td>
    <td><%= link_to 'Show', qvvaluf %></td>
    <td><%= link_to 'Edit', edit_qvvaluf_path(qvvaluf) %></td>
    <td><%= link_to 'Destroy', qvvaluf, :confirm => 'Are you
sure?', :method => :delete %></td>
<% end %>

<br />

<%= link_to 'New qvvaluf', new_qvvaluf_path %>
This topic is locked and can not be replied to.