ActionController::RoutingError in Products#index

Env: rails 2.2.2
oracle 10g

Have created a table and sequence

create table products (
id number not null,
title varchar2(100) not null,
description varchar2(255) not null,
image_url varchar2(200) not null,
price number(10,2) not null,
primary key(id)
)

create sequence products_seq
start with 1
increment by 1
nomaxvalue

No errors displaying all the products using the default action index
But when I put show/edit links , it errors out.
Is this show link is not able to get the product id ?
Please help.
route.rb is good. I did look at rake route output.

Error

ActionController::RoutingError in Products#index

Showing app/views/products/index.html.erb where line #17 raised:

product_url failed to generate from {:action=>“show”,
:controller=>“products”, :id=>#<Product id:
#BigDecimal:506ca20,‘0.1E1’,4(8), title: “Laptop”, description:
“Laptop - TODO”, image_url: “http://localhost:3000/products/new”, price:
#BigDecimal:506c958,‘0.2E4’,4(12)>}, expected: {:action=>“show”,
:controller=>“products”}, diff: {:id=>#<Product id:
#BigDecimal:506c764,‘0.1E1’,4(8), title: “Laptop”, description:
“Laptop - TODO”, image_url: “http://localhost:3000/products/new”, price:
#BigDecimal:506c69c,‘0.2E4’,4(12)>}

Extracted source (around line #17):

14: <%=h product.description %>
15: <%=h product.image_url %>
16: <%=h product.price %>
17: <%= link_to ‘Show’, product %>
18: <%= link_to ‘Edit’, edit_product_path(product) %>
19: <%= link_to ‘Destroy’, product, :confirm => ‘Are you sure?’,
:method => :delete %>
20:

RAILS_ROOT: C:/Documents and Settings/beesaa/Desktop/ruby/web/depot
Application Trace | Framework Trace | Full Trace

C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:377:in
raise_named_route_error' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/routing/route_set.rb:341:in generate’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/url_rewriter.rb:208:in
rewrite_path' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/url_rewriter.rb:187:in rewrite_url’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/url_rewriter.rb:165:in
rewrite' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_controller/base.rb:626:in url_for’
C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/url_helper.rb:85:in
send' C:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/url_helper.rb:85:in url_for’
(eval):16:in product_path' app/views/products/index.html.erb:17 app/views/products/index.html.erb:11:in each’
app/views/products/index.html.erb:11
app/controllers/products_controller.rb:7:in `index’

Hi Ashok,

id’s are always integer. I’m quite sure it’s the same with an Oracle
DB.
So please fix you database and retry.

ciao, tom

On Feb 11, 6:19 pm, Ashok B. [email protected]
wrote:

create table products (
id number not null,

primary key(id)
)


Thomas R. “TomK32” Koll <> http://ananasblau.com
just a geek trying to change the world
TomK32 (Thomas R. Koll) · GitHub

Thomas r. Koll wrote:

Hi Ashok,

id’s are always integer. I’m quite sure it’s the same with an Oracle
DB.
So please fix you database and retry.

ciao, tom

On Feb 11, 6:19�pm, Ashok B. [email protected]
wrote:

create table products (
id number not null,

primary key(id)
)


Thomas R. “TomK32” Koll <> http://ananasblau.com
just a geek trying to change the world
TomK32 (Thomas R. Koll) · GitHub

Thanks Thomas.
Have corrected my table create statement.
When I create a table and corresponding sequence manually, why scaffold
script does not create the views with proper table fields in it?
When I do
C:\Documents and Settings\xyz\Desktop\ruby\web\ab>ruby script\generate
scaffo
ld address first_name:string last_name:string address:string
phone:integer email
this , it creates the views well.
Do I need to give the script a hint regarding the tables fields ?

Change
Copy_book
To
Copy_book_path(copy_book)
Sent from my BlackBerry smartphone from Sinyal Bagus XL, Nyambung
Teruuusss…!

No use … still i m getting error :frowning:

hi all,

i m also facing the same issue pls suggest me a solution???

ActionController::RoutingError in copy_books#index
Showing app/views/copy_books/index.html.erb where line #32 raised:

29:

<%=h copy_book.last_modified_by_user.username %>
30: <%=h copy_book.creation_time %>
31: <%=h copy_book.created_by_user.username %>
32: <%= link_to ‘Show’, copy_book %>
33: <%= link_to ‘Edit’, edit_copy_book_path(copy_book) %>
34: <%= link_to ‘Destroy’, copy_book, :confirm => ‘Are you
sure?’, :method => :delete %>
35:

thanks in advance…

Regards,
Arul