Add respond_with location option to docs Edit #10988

merged 1 commit into from Jun 18, 2013


None yet

2 participants

tute commented Jun 18, 2013

No description provided.

@senny senny commented on an outdated diff Jun 18, 2013
@@ -97,8 +97,17 @@ module ActionController #:nodoc:
# This will return status 201 if the task was saved successfully. If not,
# it will simply ignore the given options and return status 422 and the
- # resource errors. To customize the failure scenario, you can pass a
- # a block to <code>respond_with</code>:
+ # resource errors. You can also override the location to redirect to:
+ #
+ # def create
+ # @project = Project.find(params[:project_id])
+ # @task =[:task])
+ # flash[:notice] = 'Task was successfully created.' if
+ # respond_with(@project, location: root_path)
+ # end
senny Jun 18, 2013 Ruby on Rails member

I don't think we need to copy the whole example from above, one should be able to infere it from the context and we can simply show the respond_with call:

You can also override the location to redirect to:

respond_with(@project, location: root_path)
tute commented Jun 18, 2013

Agree @senny, fixed.

@senny senny merged commit 37e6201 into rails:master Jun 18, 2013

1 check was pending

Details default The Travis CI build is in progress
senny commented Jun 18, 2013

thanks 💛

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment