# RESTful but use create in another controller

**URL:** <https://www.ruby-forum.com/t/restful-but-use-create-in-another-controller/135611>\
**Category:** Rails\
**Created:** [April 23, 2008, 4:19pm UTC](https://www.ruby-forum.com/t/restful-but-use-create-in-another-controller/135611 "2008-04-23T16:19:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 23, 2008, 4:19pm UTC](https://www.ruby-forum.com/t/restful-but-use-create-in-another-controller/135611/1 "2008-04-23T16:19:24Z")

</div>

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| %\>

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 23, 2008, 7:00pm UTC](https://www.ruby-forum.com/t/restful-but-use-create-in-another-controller/135611/2 "2008-04-23T19:00:46Z")

</div>

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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![paulbutcher](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/a5b964/32.png) [@paulbutcher](https://www.ruby-forum.com/u/paulbutcher)\
**Post date:** [April 23, 2008, 8:04pm UTC](https://www.ruby-forum.com/t/restful-but-use-create-in-another-controller/135611/3 "2008-04-23T20:04:46Z")

</div>

removed\_email\_address@domain.invalid 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 [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

That’s true. But what if I want to redirect\_to another action and still  
use the create in the MessagesController?
