I have a RESTful setup, where one is for messages. In MessagesController I have the basic methods. But I have problems when I want to "create" from another controller. I took the form in new.erb.html from message view and copied that to a new file in views in a different location, and another controller. What if I want to have a method in the new controller called create_message, how should this form_for be changed? <% form_for(@message) do |f| %> -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Apr-23 17:00 UTC
Re: RESTful but use create in another controller
What is the "create" action currently doing in the MessagesController? "New" can surely be from a different controller, but if you''re being RESTful, why not keep "create" in the MessagesController? You can pass in options, though: <% form_for @message, :url => path do |f| %> Stephen On Apr 23, 9:19 am, Pål Bergström <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> I have a RESTful setup, where one is for messages. In MessagesController > I have the basic methods. But I have problems when I want to "create" > from another controller. I took the form in new.erb.html from message > view and copied that to a new file in views in a different location, and > another controller. What if I want to have a method in the new > controller called create_message, how should this form_for be changed? > > <% form_for(@message) do |f| %> > -- > Posted viahttp://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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> What is the "create" action currently doing in the MessagesController? > > "New" can surely be from a different controller, but if you''re being > RESTful, why not keep "create" in the MessagesController? > On Apr 23, 9:19�am, P�l Bergstr�m <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>That''s true. But what if I want to redirect_to another action and still use the create in the MessagesController? -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---