# Help me with :only in Route of Rails

**URL:** <https://www.ruby-forum.com/t/help-me-with-only-in-route-of-rails/227944>\
**Category:** Rails\
**Created:** [April 4, 2013, 7:29am UTC](https://www.ruby-forum.com/t/help-me-with-only-in-route-of-rails/227944 "2013-04-04T07:29:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![haxuanlac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9bcb4/32.png) [@haxuanlac](https://www.ruby-forum.com/u/haxuanlac)\
**Post date:** [April 4, 2013, 7:29am UTC](https://www.ruby-forum.com/t/help-me-with-only-in-route-of-rails/227944/1 "2013-04-04T07:29:55Z")

</div>

I’m learning with routing in rails from :

> **[Rails Routing from the Outside In — Ruby on Rails Guides](https://guides.rubyonrails.org/routing.html)**
>
> Rails Routing from the Outside InThis guide covers the user-facing features of Rails routing.After reading this guide, you will know: How to interpret the code in config/routes.rb. How to construct your own routes, using either the preferred...

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?

---

<div class="post-metadata">

**Author:** ![haxuanlac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9bcb4/32.png) [@haxuanlac](https://www.ruby-forum.com/u/haxuanlac)\
**Post date:** [April 4, 2013, 9:05am UTC](https://www.ruby-forum.com/t/help-me-with-only-in-route-of-rails/227944/2 "2013-04-04T09:05:30Z")

</div>

On 4 April 2013 06:29, haxuan lac [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’m learning with routing in rails from :  
> [Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html)  
> 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](http://railstutorial.org), which is free to  
use online. That will show you the basics of rails.

Colin

---

<div class="post-metadata">

**Author:** ![haxuanlac](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/e9bcb4/32.png) [@haxuanlac](https://www.ruby-forum.com/u/haxuanlac)\
**Post date:** [April 4, 2013, 10:34am UTC](https://www.ruby-forum.com/t/help-me-with-only-in-route-of-rails/227944/3 "2013-04-04T10:34:36Z")

</div>

Thanks Colin.  
I’m learning step by step Ruby on Rails with [Railstutorial.org](http://Railstutorial.org)  
I solved my problem.
