How to call a method in a controller with link_to?

Hello everyone, I have a MessagesController created with rails g scaffold and the user may create messages that get saved, in tihs controller I have a method called 'tweet' that (using the twitter gem / Twitter API) triggers the given message to twitter. However I don't know how to put a tweet link in my /tweets/index.html.erb... you know this link won't be calling an action (edit, destroy, new), this link will be calling a method created by myself in the controller. Can you help me?

P.S: I am using rails 3.


Rodrigo Alves Vieira


resources :messages do   member do     get :tweet   end end

should give you a tweet_message_path to use in a view like

<%= link_to('Tweet This', tweet_message_path( %>

and direct the app to your tweet method in the messages_controller