# Custom method in restful design

**URL:** <https://www.ruby-forum.com/t/custom-method-in-restful-design/116333>\
**Category:** Rails\
**Created:** [October 4, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/custom-method-in-restful-design/116333 "2007-10-04T15:27:19Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [October 4, 2007, 3:27pm UTC](https://www.ruby-forum.com/t/custom-method-in-restful-design/116333/1 "2007-10-04T15:27:19Z")

</div>

Hi all,

I want to make a custom method in my restful users controller. The  
method ‘activate’, activates and finalizes the signup proces of a  
user.

The method should get the id and the activation code of the user  
(provided via the link in the mail) and see if it matches. the user  
should be send to the activation view.

Can someone tell me how I make this custom method? I defined the  
activate method in the controller and have added something like  
map.resources :users, :member =\> { :activate =\> :get}  
to my routes

I really don’t know wether I should take the get, post or put (and  
what they actually mean).

maybe someone can clarify this?

many thanks  
Stijn

---

<div class="post-metadata">

**Author:** ![Tarscher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@Tarscher](https://www.ruby-forum.com/u/Tarscher)\
**Post date:** [October 30, 2007, 5:41pm UTC](https://www.ruby-forum.com/t/custom-method-in-restful-design/116333/2 "2007-10-30T17:41:26Z")

</div>

In your routes.db, put something like this:

map.resources :projects do |projects|  
projects.resources :chat\_messages, :collection =\> { :show\_recent  
=\> :get}  
end

You can call your function using:

show\_recent\_project\_chat\_messages\_path(@project)

… it’s beautiful 🙂

Martijn
