# Legacy database: help needed

**URL:** <https://www.ruby-forum.com/t/legacy-database-help-needed/156038>\
**Category:** Rails\
**Created:** [December 19, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038 "2008-12-19T18:02:04Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [December 19, 2008, 6:02pm UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038/1 "2008-12-19T18:02:04Z")

</div>

Sorry if the message below appears twice. Posted it to rubyonrails-talk  
at google over an hour ago, but have not seen the message appear yet…

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 %\>

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [December 19, 2008, 6:07pm UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038/2 "2008-12-19T18:07:48Z")

</div>

> undefined method `qvvaluf\_path’ for #ActionView::Base:0x4953c34

Those methods come from routes.rb. DO you still have  
map.resources :recipes in there ?

Fred

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [December 20, 2008, 11:34am UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038/3 "2008-12-20T11:34:35Z")

</div>

Frederick C. wrote:

> > undefined method `qvvaluf\_path’ for #ActionView::Base:0x4953c34
> 
> Those methods come from routes.rb. DO you still have  
> map.resources :recipes in there ?
> 
> Fred

Yes, as stated I have added

map.resources :qvvalup

to “routes.rb”. The rest I left as is after the scaffold generation. So  
the map to recipes is still in there. I addad my line just after the map  
recipes line.

The rest is left as well. So at the bottom of the file, there are two  
'general" routes.

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [December 22, 2008, 10:22am UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038/4 "2008-12-22T10:22:58Z")

</div>

Ryan B. wrote:

> ## qvvalup is not the same as qvvaluf, unless you’re speaking a language I’m not recognising. Rails works “best” with english words and pluralization. Somewhere in your app you’re referencing qvvaluf\_path… probably a scaffold somewhere. Got a stack trace for us?
> 
> Ryan B.  
> Freelancer  
> [http://frozenplague.net](http://frozenplague.net)

I am working with a legacy database and so pluralization is out of the  
question. But in the same way Rails uses pluralization, we have  
“generalized” and use P as suffix for tables and F as suffix for  
records. Hence the qvvalup and qvvaluf.

You are right for the scaffold. Used the scaffold generator to provide  
for a skeleton for the recipes example, then just did a very basic  
search/replace, replacing recipes with qvvalup and recipe with qvvaluf.

Below a stack trace and my index.html.erb where you can find all my  
“replacements” of recipes and recipe. Perhaps I should have replaced  
recipe with qvvalup insteas of qvvaluf ?

Stacktrace:

c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/polymorphic\_routes.rb:112:in  
` __send__' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/polymorphic_routes.rb:112:in `polymorphic\_url’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_controller/polymorphic\_routes.rb:119:in  
`polymorphic_path' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/url_helper.rb:91:in `url\_for’  
c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action\_view/helpers/url\_helper.rb:228:in  
`link_to' app/views/qvvalup/index.html.erb:17 app/views/qvvalup/index.html.erb:11:in `each’  
app/views/qvvalup/index.html.erb:11  
app/controllers/qvvalup\_controller.rb:7:in `index’

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 %\>

---

<div class="post-metadata">

**Author:** ![mslagell](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e274bd/32.png) [@mslagell](https://www.ruby-forum.com/u/mslagell)\
**Post date:** [December 20, 2008, 11:45am UTC](https://www.ruby-forum.com/t/legacy-database-help-needed/156038/5 "2008-12-20T11:45:01Z")

</div>

## qvvalup is not the same as qvvaluf, unless you’re speaking a language I’m not recognising. Rails works “best” with english words and pluralization. Somewhere in your app you’re referencing qvvaluf\_path… probably a scaffold somewhere. Got a stack trace for us?

Ryan B.  
Freelancer

> **[frozenplague.net](http://frozenplague.net)**
>
> This domain may be for sale!
