views:

16

answers:

1

Hello folks, I made a tweet scaffold(controllers, models,views,..) in my Rails 3 app and among all the usual controller methods I have a 'tweet' method in my TweetsController. In my views, among the 'edit' and 'delete' links, I want a 'tweet' link, so this link should post the message to Twitter. Because when I simply create a tweet, it does't go to twitter directly, it remains listed in tweets/index.html.erb, it goes only to twitter if I click the tweet button. Can you help me? I think I should somehow point the link to the tweet method in TweetsController.

Please help!

Thanks!

A: 

Hello everyone, I solved my problem. To get this thing done, I wrote the following:

First, add in config/routes.rb:***

get 'tweet/:id', :as => 'tweet', :to => "tweets#tweet"

Then, add in your view: <%= link_to 'tweet', "tweet/#{tweet.id}" %>

Done!

rodrigo3n