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: <td><%=h product.description %></td>
15: <td><%=h product.image_url %></td>
16: <td><%=h product.price %></td>
17: <td><%= link_to 'Show', product %></td>
18: <td><%= link_to 'Edit', edit_product_path(product) %></td>
19: <td><%= link_to 'Destroy', product, :confirm => 'Are you sure?',
:method => :delete %></td>
20: </tr>
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'
on 2009-02-11 18:19
on 2009-02-11 21:02
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 Bee <rails-mailing-l...@andreas-s.net> 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 http://github.com/TomK32
on 2009-02-12 17:34
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 Bee <rails-mailing-l...@andreas-s.net> > 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 > http://github.com/TomK32 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 ?
on 2012-12-21 12:05
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: <td><%=h copy_book.last_modified_by_user.username %></td> 30: <td><%=h copy_book.creation_time %></td> 31: <td><%=h copy_book.created_by_user.username %></td> 32: <td><%= link_to 'Show', copy_book %></td> 33: <td><%= link_to 'Edit', edit_copy_book_path(copy_book) %></td> 34: <td><%= link_to 'Destroy', copy_book, :confirm => 'Are you sure?', :method => :delete %></td> 35: </tr> thanks in advance.. Regards, Arul
on 2012-12-21 12:18
Change Copy_book To Copy_book_path(copy_book) Sent from my BlackBerry smartphone from Sinyal Bagus XL, Nyambung Teruuusss...!
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.