I'm trying to make use of rails 3's respond_to/respond_with mechanism for restful controllers. I'm finding that when I try and use those features within a namespaced controller the redirects fail and i have to specify the optional location: parameter on the respond_with.
So right now I have:
def Admin::FooController
respond_to :html, :xml
def create
@foo = Foo.new(params[:foo])
@foo.save
respond_with(@foo, location: admin_foo_path(@foo))
end
end
If I don't provide the location 开发者_如何转开发parameter it attempts to redirect to just foo_path(@foo)
Any ideas as to why this would be / if I'm doing something wrong or does rails 3's default responder just not handle namespaced URL routes?
respond_with(:admin, @foo)
This blog has more..
精彩评论