Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Rails 3 Compatibility #2

Open
wants to merge 2 commits into from

5 participants

@jrust

This commit makes the gem rails 3 compatible. While I couldn't find a substitute for the rails 2 erase_redirect_results, I did find a solution for the double render problem and the gem is working fine on my end with rails 3.2 and ruby 1.9.

@ndbroadbent

Awesome, thanks for this! It would be great if this could be merged, and a new gem released.

Cheers!

@keithepley

I get a AbstractController::DoubleRenderError when I try to use this in Rails 3.0.11

@ndbroadbent

Hi @markcatley, would you please be able to merge these changes, and release a new version of your gem?
We've had to release an updated gem under our own name for now (responds_to_parent_ffcrm), but it would be great to depend on your version. Cheers

@markcatley
Owner

Hi Guys,

Sorry for my absence.

I am not actually doing web development any more, so find it hard to find time to do updates to this sort of thing.

I was actually never the initial author of this code, I just imported the original from subversion and posted it here as I was using it at the time.

I am happy to hand this over to anyone who would like to take responsibility for maintaining it. Just let me know who and I will transfer the repository and access to the ruby gem.

Cheers,
Mark

@ndbroadbent

Hi Mark, thanks for your response! We at Fat Free CRM would be very happy to take responsibility for this repo.
It would be awesome if you could please transfer the repository to the fatfreecrm organization, and give me access to the ruby gem via my email address: nathan.f77@gmail.com

Thanks very much!

@markcatley
Owner

Done.

@ndbroadbent

Thanks very much! I've pushed the new Rails 3.x compatible gem, with version 1.1.0.

@grosser

please close this

@grosser

@markcatley can you give github access to @ndbroadbent ?
@ndbroadbent can you push your changes to this repo <-> rubygems has version 1.1.0 and this repo is 1.0.20130516

Also a new release from master would be nice to get ruby 2 support out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 1, 2012
  1. @jrust

    Make rails 3 compatible

    jrust authored
Commits on Mar 2, 2012
  1. @jrust

    Gemspec needs author

    jrust authored
This page is out of date. Refresh to see the latest.
View
11 lib/responds_to_parent/action_controller.rb
@@ -9,18 +9,19 @@ def responds_to_parent(&block)
if performed?
# Either pull out a redirect or the request body
- script = if location = erase_redirect_results
+ script = if response.headers['Location']
+ #TODO: erase_redirect_results is missing in rails 3.0
"document.location.href = '#{self.class.helpers.escape_javascript location.to_s}'"
else
response.body || ''
end
- # Clear out the previous render to prevent double render
- erase_results
-
# We're returning HTML instead of JS or XML now
response.headers['Content-Type'] = 'text/html; charset=UTF-8'
+ # Clear out the previous render to prevent double render
+ response.request.env['action_controller.instance'].instance_variable_set(:@_response_body, nil)
+
# Eval in parent scope and replace document location of this frame
# so back button doesn't replay action on targeted forms
# loc = document.location to be set after parent is updated for IE
@@ -35,4 +36,4 @@ def responds_to_parent(&block)
end
alias respond_to_parent responds_to_parent
end
-end
+end
View
1  responds_to_parent.gemspec
@@ -2,6 +2,7 @@ spec = Gem::Specification.new do |s|
s.name = 'responds_to_parent'
s.version = '1.0.20091013'
s.homepage = 'http://github.com/markcatley/responds_to_parent'
+ s.authors = ['Mark Catley']
s.summary = "[Rails] Adds 'responds_to_parent' to your controller to" +
'respond to the parent document of your page.' +
'Make Ajaxy file uploads by posting the form to a hidden' +
Something went wrong with that request. Please try again.