Skip to content
Browse files

Rearrange rails3 files and fixing rails2 compatibility error

  • Loading branch information...
1 parent 7d7405a commit 22a4c38eb115956d6eb9839ca6b9abf089661e2c @jacquescrocker jacquescrocker committed Oct 29, 2010
View
2 Rakefile
@@ -44,7 +44,7 @@ require 'recurly'
Recurly.settings_path = "#{File.dirname(__FILE__)}/spec/config/recurly.yml"
-load 'recurly/rails/recurly.rake'
+load 'recurly/rails3/recurly.rake'
task :environment do
View
7 lib/recurly.rb
@@ -5,7 +5,12 @@
require 'recurly/version'
require 'recurly/formats/xml_with_pagination'
require 'recurly/config_parser'
-require 'recurly/rails/railtie' if defined?(::Rails::Railtie)
+require 'recurly/rails3/railtie' if defined?(::Rails::Railtie)
+
+# load rails2 fixes
+if defined?(::Rails::VERSION::MAJOR) and ::Rails::VERSION::MAJOR == 2
+ require 'recurly/rails2/compatibility'
+end
# configuration
module Recurly
View
8 lib/recurly/rails2/compatibility.rb
@@ -0,0 +1,8 @@
+# ActiveResource workaround for Rails 2.x
+# https://rails.lighthouseapp.com/projects/8994/tickets/1472-activeresource-222-errorsfrom_xml-cant-handle-symboled-attribute-keys-because-of-humanize-call
+#
+class Symbol
+ def humanize
+ to_s.humanize
+ end
+end
View
2 lib/recurly/rails/railtie.rb → lib/recurly/rails3/railtie.rb
@@ -1,7 +1,7 @@
module Recurly
class Railtie < ::Rails::Railtie
rake_tasks do
- load 'recurly/rails/recurly.rake'
+ load 'recurly/rails3/recurly.rake'
end
config.after_initialize do
View
0 lib/recurly/rails/recurly.rake → lib/recurly/rails3/recurly.rake
File renamed without changes.

0 comments on commit 22a4c38

Please sign in to comment.
Something went wrong with that request. Please try again.