# Redirect\_to doesn't work for create action

**URL:** <https://www.ruby-forum.com/t/redirect-to-doesnt-work-for-create-action/191725>\
**Category:** Rails\
**Created:** [July 16, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/redirect-to-doesnt-work-for-create-action/191725 "2010-07-16T19:48:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ektayogesh](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/c6cbf5/32.png) [@ektayogesh](https://www.ruby-forum.com/u/ektayogesh)\
**Post date:** [July 16, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/redirect-to-doesnt-work-for-create-action/191725/1 "2010-07-16T19:48:45Z")

</div>

Hi,

I am trying to use redirect\_to in one of my action in a controller class

I want it to redirect to another controller create action which is a  
HTTP POST method, I tried different option but none of them seems to  
work.

Here is my code

class HomesController \< ApplicationController  
def login  
redirect\_to sessionmanagers\_path(:method=\>:post)  
end  
end

my routes.rb has the following

map.resource :sessionmanagers  
map.resources :homes

The other way that i tried is

redirect\_to sessionmanagers\_path(:method=\>:post)  
redirect\_to sessionmanagers\_path, :method=\>:post  
redirect\_to sessionmanagers\_path, :method=\>“post”

I am expecting it to go the Sessionmanagers controller and create action

When I do rake routes i get the following

new\_sessionmanagers GET /sessionmanagers/new(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“new”}  
edit\_sessionmanagers GET /sessionmanagers/edit(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“edit”}  
sessionmanagers GET /sessionmanagers(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“show”}  
PUT /sessionmanagers(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“update”}  
DELETE /sessionmanagers(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“destroy”}  
POST /sessionmanagers(.:format)  
{:controller=\>“sessionmanagers”, :action=\>“create”}

Any help is appreciated.
