Help me with :only in Route of Rails

I’m learning with routing in rails from :

and I have first code : resources :users
and last code: resources :users, :only => [:index, :show]
and have error :
undefined method `edit_user_path’ for #<#Class:0x2d9d068:0x53dacb0>
can you help me this problem?

On 4 April 2013 06:29, haxuan lac [email protected] wrote:

I’m learning with routing in rails from :
Rails Routing from the Outside In — Ruby on Rails Guides
and I have first code : resources :users
and last code: resources :users, :only => [:index, :show]
and have error :
undefined method `edit_user_path’ for #<#Class:0x2d9d068:0x53dacb0>

Your :only spec says that only index and show are valid user actions.
The error says that you have tried to use edit. Either you need to
include :edit in the :only spec or you need to change the code that is
resulting in edit being actioned.

If you have not already done so then it would be worth working right
through a good tutorial such as railstutorial.org, which is free to
use online. That will show you the basics of rails.

Colin

Thanks Colin.
I’m learning step by step Ruby on Rails with Railstutorial.org
I solved my problem.