开发者

respond_with and namespaced controller

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..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜