rails:3730
From: Kobori Makoto <kbrmct@g...>
Date: Wed, 15 Feb 2012 03:01:44 +0900
Subject: [rails:3730] routes.rbの書き方
こぼりです
なかなか習得できないroutes.rbの書き方です。。。
カスタマーから、個々の商品を見れるようにしようと、customer#seeを作りました。
resources :customers,:only=>[:index] do
get :see ,:on=> :member
end
rake resourcesはこうなりました。
rake routes CONTROLLER=customers
see_customer GET /customers/:id/see(.:format)
{:controller=>"customers", :action=>"see"}
customers GET /customers(.:format)
{:controller=>"customers", :action=>"index"}
customer_root GET /customers(.:format)
{:controller=>"customers", :action=>"index"}
customer#indexのhtmlにリンクを張るために、
<%= link_to sakka.name ,see_customer%>
と書きましたが、
undefined local variable or method `see_customer' for
#<#<Class:0x109037ff0>:0x109036380>
と出てしまいます。
routesにもかかれているのに、なぜ認識してくれないのか。。。
ご助言をよろしくお願いいたします。
--
ML: rails@r...
使い方: http://QuickML.com/
-> 3730 2012-02-14 19:01 [kbrmct@g... ] routes.rbの書き方 3731 2012-02-15 02:13 ┗[netwillnet@g... ]