-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect after create. Remove edit and update actions #56
Comments
Hi @slenderock. Sorry for the delay in looking into this. I have now implemented both of these features in To change the redirect path, you can use the Trestle.resource(:articles) do
# Update return location for a single action
return_to on: :create do |instance|
path(:edit, id: to_param(instance))
end
# Update return locations for create, update and destroy
return_to do
path(:index)
end
end I have also implemented the Trestle.resource(:articles) do
remove_action :edit, :update
end |
Hi I'm not been able to reproduce the redirect behaviour: The overwriting function is triggered:
But path() function is undefined. |
Same for me. It worked for me like this:
This returns to the edit view of the |
The Here is an up-to-date version of my previous example: Trestle.resource(:articles) do
# Update return location for a single action
return_to on: :create do |instance|
admin.instance_path(instance, action: :edit)
end
# Update return locations for create, update and destroy
return_to do
admin.path(:index)
end
end |
I'm trying to use this to redirect after a delete, but I'm running into some trouble. For context, we're displaying a list of Once a
But it isn't working, resulting in the error I'm sure this is just a case of passing the correct parameter to the Thank you. |
@LimeBlast Since you are within the blocks admin, the |
Thank you, @spohlenz - I think you meant
UPDATE: or maybe you did mean |
Hi there
First of all thanks a lot for your work. It works good and looks beauty.
Can I somehow change redirect path after create? (want change it to index action)
Also I want remove ability to edit and update record?
I found
readonly: true
mode, but I want to keep[:new, :create, :delete]
actionsThe text was updated successfully, but these errors were encountered: