Legacy database: help needed


#1

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…

Thanks,
Mark

“index.html.erb”:

Werken met valuta

<% for qvvaluf in @qvvalup %>

<% end %>
Valuta Omschrijving Koers Aantal decimalen
<%=h qvvaluf.qvqvcode %> <%=h qvvaluf.qvqvomsc %> <%=h qvvaluf.qvqvkoer %> <%=h qvvaluf.qvqvaant %> <%= link_to 'Show', qvvaluf %> <%= link_to 'Edit', edit_qvvaluf_path(qvvaluf) %> <%= link_to 'Destroy', qvvaluf, :confirm => 'Are you sure?', :method => :delete %>

<%= link_to ‘New qvvaluf’, new_qvvaluf_path %>