# Redirect\_to :create

**URL:** <https://www.ruby-forum.com/t/redirect-to-create/188497>\
**Category:** Rails\
**Created:** [May 13, 2010, 12:01am UTC](https://www.ruby-forum.com/t/redirect-to-create/188497 "2010-05-13T00:01:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![badnaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@badnaam](https://www.ruby-forum.com/u/badnaam)\
**Post date:** [May 13, 2010, 12:01am UTC](https://www.ruby-forum.com/t/redirect-to-create/188497/1 "2010-05-13T00:01:21Z")

</div>

My requirement is to maintain historical data, so basically each  
update creates a new record rather than updating the current record.  
In order to do this, I fetch the the latest record in the “edit”  
action and when the form is submitted I am trying to  
redirect\_to :action =\> “create” in the update action.

But for some reason instead it gets redirected to the index action  
instead. When I debug, I can see that the form gets submitted to the  
“udpate” action but after the redirect\_to line, instead of going into  
the create action it tries to find some default\_renderer…

def update  
redirect\_to :action =\> “create”  
end

Am I doing this right?

Thanks

---

<div class="post-metadata">

**Author:** ![badnaam](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/e36b37/32.png) [@badnaam](https://www.ruby-forum.com/u/badnaam)\
**Post date:** [May 13, 2010, 12:22am UTC](https://www.ruby-forum.com/t/redirect-to-create/188497/2 "2010-05-13T00:22:59Z")

</div>

On Wed, May 12, 2010 at 6:00 PM, badnaam [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> def update  
> redirect\_to :action =\> “create”  
> end
> 
> Am I doing this right?

I’d say no, you’re not.

Keeping back versions of a model should be the responsibility of the  
model, not the controller.

You’re still updating the record, the difference is what happens when  
you do. The typical way to do this would be to use something like a  
before\_save callback on the model to save the old version.

You might want to look at something like version\_fu

> **[GitHub - jmckible/version\_fu: Rails 3 update of acts\_as\_versioned](https://github.com/jmckible/version_fu)**
>
> Rails 3 update of acts\_as\_versioned. Contribute to jmckible/version\_fu development by creating an account on GitHub.

–  
Rick DeNatale

Blog: [http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)  
Github: [rubyredrick (Rick DeNatale) · GitHub](http://github.com/rubyredrick)  
Twitter: @RickDeNatale  
WWR: [http://www.workingwithrails.com/person/9021-rick-denatale](http://www.workingwithrails.com/person/9021-rick-denatale)  
LinkedIn: [http://www.linkedin.com/in/rickdenatale](http://www.linkedin.com/in/rickdenatale)
