# Calling a non-default method of my controller in my views?

**URL:** <https://www.ruby-forum.com/t/calling-a-non-default-method-of-my-controller-in-my-views/195343>\
**Category:** Rails\
**Created:** [September 21, 2010, 11:15pm UTC](https://www.ruby-forum.com/t/calling-a-non-default-method-of-my-controller-in-my-views/195343 "2010-09-21T23:15:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rodrigo3n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@rodrigo3n](https://www.ruby-forum.com/u/rodrigo3n)\
**Post date:** [September 21, 2010, 11:15pm UTC](https://www.ruby-forum.com/t/calling-a-non-default-method-of-my-controller-in-my-views/195343/1 "2010-09-21T23:15:40Z")

</div>

Hello everyone, I have a messages\_controller, inside this controller,  
among all the default methods I have a tweet method that sends the  
message to twitter, and aside the ‘edit’ and ‘destroy’ links I want a  
‘tweet’ one. However, I don’t know how invoke this method in my app/  
views/messages/index.html.erb and I don’t know if I must add something  
in config/routes.rb, if you know, please help me!

Thanks!

Rodrigo Alves V.!

---

<div class="post-metadata">

**Author:** ![rodrigo3n](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a8b319/32.png) [@rodrigo3n](https://www.ruby-forum.com/u/rodrigo3n)\
**Post date:** [September 22, 2010, 12:22am UTC](https://www.ruby-forum.com/t/calling-a-non-default-method-of-my-controller-in-my-views/195343/2 "2010-09-22T00:22:24Z")

</div>

On Tue, Sep 21, 2010 at 4:14 PM, rodrigo3n [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello everyone, I have a messages\_controller, inside this controller,  
> among all the default methods I have a tweet method that sends the  
> message to twitter, and aside the ‘edit’ and ‘destroy’ links I want a  
> ‘tweet’ one. However, I don’t know how invoke this method in my app/  
> views/messages/index.html.erb and I don’t know if I must add something  
> in config/routes.rb, if you know, please help me!
> 
> Thanks!
> 
> Rodrigo Alves V.!

Assuming you’re using Rails 3, read the guide on routing:  
[Rails Routing from the Outside In — Ruby on Rails Guides](http://guides.rubyonrails.org/routing.html). It’s very helpful and will  
explain how to connect a new action like you have here. The upshot is to  
route it as a member action that can be invoked on a specific Message.  
Then  
you’ll have a nice named route you can use in your view, like  
tweet\_message\_path(@message).
