rodrigo3n
2010-Sep-21 21:12 UTC
Calling a non-default method of my controller in my views?
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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
rodrigo3n
2010-Sep-21 21:14 UTC
Calling a non-default method of my controller in my views?
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 Vieira! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Adam Stegman
2010-Sep-21 22:20 UTC
Re: Calling a non-default method of my controller in my views?
On Tue, Sep 21, 2010 at 4:14 PM, rodrigo3n <rodrigo3n-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Vieira!Assuming you''re using Rails 3, read the guide on routing: 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). -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Veera Sundaravel
2010-Sep-22 05:14 UTC
Re: Calling a non-default method of my controller in my views?
rodrigo3n 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 > ''tweetYou can specify this ''tweet'' method as a member action of your controller in routes.rb T.Veerasundaravel. http://tinyurl.com/25vma7h @veerasundaravel -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-22 11:08 UTC
Re: Re: Calling a non-default method of my controller in my views?
first watch this to understand what you have to do http://railscasts.com/episodes/35-custom-rest-actions then watch this to see how it was upgraded in rails 3 http://railscasts.com/episodes/203-routing-in-rails-3 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.