Skip to content
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

Adding the RedirectToOverrides to enable redirect_to also for remotipart submitted actions. #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Bharat311
Copy link

Currently, remotipart only allows us to render partials with ajax forms having file uploads. This PR provides a class 'RedirectToOverrides' similar to existing 'RenderOverrides' that can handle 'redirect_to' in case of file uploads done via remotipart.

@johnnyshields
Copy link

👍 +1 using this successfully in production

include ERB::Util

def self.included(base)
base.class_eval do

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use send instead of class_eval, it will make code faster.

@johnnyshields
Copy link

@JangoSteve any chance of getting this merged?

@esbanarango
Copy link
Collaborator

@johnnyshields I'll check this.


def redirect_to_with_remotipart *args
if remotipart_submitted?
case redirect_path = args.shift

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem to handle the case of something like redirect_to @post

@jszwedko
Copy link

Would love to see this merged, just ran into it today -- working around it by vendoring the above file and including in ApplicationController.

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

Successfully merging this pull request may close these issues.

5 participants