# Scaffolding

**URL:** <https://www.ruby-forum.com/t/scaffolding/190999>\
**Category:** Rails\
**Created:** [July 2, 2010, 8:59am UTC](https://www.ruby-forum.com/t/scaffolding/190999 "2010-07-02T08:59:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [July 2, 2010, 8:59am UTC](https://www.ruby-forum.com/t/scaffolding/190999/1 "2010-07-02T08:59:32Z")

</div>

Hello All,

I am using scaffolding but i can not figure out that how to write my own  
methods except CRUD. I mean i know how to use CRUD methods but if i  
write my own method in my controller and call that from views then the  
request is going to show method.

Ok… the scenario is that have an method abc\_whatever in my controller.  
So i call this as ModelName/abc\_whatever from the views. Before using  
scaffolding it was going fine but after scaffolding this request is  
going to show method. Is it something to do with routes…?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [July 2, 2010, 11:55am UTC](https://www.ruby-forum.com/t/scaffolding/190999/2 "2010-07-02T11:55:29Z")

</div>

IMHO, you really need to study the routes and how restful routing  
works. [Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html)  
Scaffolding must have had generated the restful routing for the said  
controller and thus no other method except CRUD is being entertained  
unless specified.

add your method in the file config/routes.rb like this…

Say your controller is posts

map.resources :posts, :collection =\> {:abc\_whatever =\> :any}

regards,  
Sur  
[http://crimson9.com](http://crimson9.com)

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [July 2, 2010, 12:13pm UTC](https://www.ruby-forum.com/t/scaffolding/190999/3 "2010-07-02T12:13:50Z")

</div>

Sur M. wrote:

> IMHO, you really need to study the routes and how restful routing  
> works. [Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html)  
> Scaffolding must have had generated the restful routing for the said  
> controller and thus no other method except CRUD is being entertained  
> unless specified.
> 
> add your method in the file config/routes.rb like this…
> 
> Say your controller is posts
> 
> map.resources :posts, :collection =\> {:abc\_whatever =\> :any}

Ok thanks a lot for your info. I’ll read them.

> regards,  
> Sur  
> [http://crimson9.com](http://crimson9.com)

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [July 3, 2010, 8:12am UTC](https://www.ruby-forum.com/t/scaffolding/190999/4 "2010-07-03T08:12:07Z")

</div>

Hemant B. wrote:

> Sur M. wrote:
> 
> > IMHO, you really need to study the routes and how restful routing  
> > works. [Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html)  
> > Scaffolding must have had generated the restful routing for the said  
> > controller and thus no other method except CRUD is being entertained  
> > unless specified.
> > 
> > add your method in the file config/routes.rb like this…
> > 
> > Say your controller is posts
> > 
> > map.resources :posts, :collection =\> {:abc\_whatever =\> :any}
> 
> Ok thanks a lot for your info. I’ll read them.
> 
> > regards,  
> > Sur  
> > [http://crimson9.com](http://crimson9.com)

Ryan B. ([http://railscasts.com/](http://railscasts.com/)) might help you a lot when setting  
collection and member method from your class Controllers to your  
routes.rb file, it will show you some techniques efficiently like  
with\_options and such … (just check it out)

Andre

---

<div class="post-metadata">

**Author:** ![hemantborole](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b782af/32.png) [@hemantborole](https://www.ruby-forum.com/u/hemantborole)\
**Post date:** [July 3, 2010, 12:13pm UTC](https://www.ruby-forum.com/t/scaffolding/190999/5 "2010-07-03T12:13:02Z")

</div>

Yes, you have to create a route for that (see config/routes.rb)  
Tutorial: [http://guides.rails.info/](http://guides.rails.info/)

Regards,  
Mirza
