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’