rails-futurizer 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 277ed0db943b5cb95f08c9441ca55db45a223cc3
4
- data.tar.gz: 5e1f297e00b4976968f12d234906076aea95b177
3
+ metadata.gz: 4d19e7d09ac51d53ff271394258aca3679e60087
4
+ data.tar.gz: 6f6e61beb959e6a70b3c6345cd5bc652a8c54557
5
5
  SHA512:
6
- metadata.gz: 2cb0b9105459eae395db0a24e0baa9df2edee9e8e71eea3bf3743d05599a4a2cf0fcbd7458822a12f0b5e334b8866ec29b07239775ceefcafb4c7bb54fc7c41b
7
- data.tar.gz: 97753285dde6d7c0c4144bc20bd79ff99f8f0be7eb1da6003ada649639696ef1acca624d580e139180541f41481655f67bfd497b247d41b9bde5346b416d78a5
6
+ metadata.gz: 7f7e51aff9bba2aac642a2655c8c5db2cda6e11e8f50552d8fc2e2f7df81c427518e6d10009fdc9747e48463f4b241818fe93c874fb6621cc3aada09c8f7bbdb
7
+ data.tar.gz: f29d8b75ba98e6385cea3c71e2d16aaca23eaad36bb48cb6b92da57ac7983a393a3bc33e7e38f9cef48124fae5f9c7f72e1d679131a2e7c4f73a560d256ba93b
data/History.md CHANGED
@@ -1,3 +1,8 @@
1
+ ### Version 1.0.1
2
+ 2014-3-11
3
+
4
+ * Patch a bug that prevents saving has_many associations in Rails 2.2 - 3.0 with Ruby 2.
5
+
1
6
  ### Version 1.0.0
2
7
  2014-3-8
3
8
 
data/README.md CHANGED
@@ -3,32 +3,71 @@
3
3
  [![Build Status](https://travis-ci.org/brianauton/rails-futurizer.png?branch=master)](https://travis-ci.org/brianauton/rails-futurizer)
4
4
  [![Code Climate](https://codeclimate.com/github/brianauton/rails-futurizer.png)](https://codeclimate.com/github/brianauton/rails-futurizer)
5
5
 
6
- Drag your legacy Rails apps into the future a little less painfully.
6
+ Drag your legacy Rails apps into the future a little more easily.
7
+
8
+ ### Introduction
9
+
10
+ Upgrading a legacy Rails app can be a frustrating process. Ideally,
11
+ you'd like to break the upgrade up into as many discrete steps as
12
+ possible: upgrade the Ruby version here, a couple gems there, and
13
+ continually commit to master with all tests passing at each step.
14
+
15
+ But these intermediate steps often involve version combinations that
16
+ are not well supported or tested (e.g. Ruby 2 + Rails 2), and a lot of
17
+ time is typically spent tracking down unexpected test failures and
18
+ cryptic error messages that result from these dangerous version
19
+ combinations.
20
+
21
+ Rails-futurizer makes the upgrade process quicker and easier by
22
+ automatically patching some of these bugs and giving clear warnings
23
+ about the cause of others. See below for a list of all patches and
24
+ warnings available.
25
+
26
+ ### What it doesn't do
27
+
28
+ It doesn't backport any features or syntax from newer Ruby/Rails
29
+ versions to older versions. Upgrade your apps; don't keep developing
30
+ them against old versions.
7
31
 
8
32
  ### Requirements
9
33
 
10
34
  * Ruby 1.8.7 or greater
11
35
 
12
- * RubyGems v1.1.0 or greater
36
+ * RubyGems 1.1.0 or greater
13
37
 
14
- * Nothing else, although rails-futurizer won't do anything unless
38
+ * Nothing else. But rails-futurizer won't do anything unless
15
39
  it's installed alongside a version of Rails for which some
16
40
  applicable fixes are available.
17
41
 
18
- ### Getting Started
42
+ ### Installation
19
43
 
20
- Install the rails-futurizer gem alongside rspec in your gemfile.
44
+ If your app is using Bundler, add the rails-futurizer gem to the
45
+ Gemfile.
21
46
 
22
47
  gem "rails-futurizer"
23
48
 
24
- That's it! Any applicable fixes will be activated automatically, and
25
- any that aren't applicable because of your current version of Rails,
26
- Ruby, etc. will be ignored.
49
+ Then update your bundle.
50
+
51
+ $ bundle
52
+
53
+ That's it! Rails-futurizer will automatically activate any fixes and
54
+ warnings that are applicable to the currently installed versions of
55
+ Ruby and Rails, and ignore those that are not applicable.
56
+
57
+ (If your app is too old to be using Bundler, consider adding Bundler
58
+ as the first step toward upgrading.)
59
+
60
+ ### Bugs Patched
61
+
62
+ The following bugs will be automatically patched when
63
+ rails-futurizer is loaded.
27
64
 
28
- ### Fixes Included
65
+ * When Rails 2.3 or older is used with Ruby 2.0 or newer, parameter
66
+ log filtering in ActionController silently fails, causing all
67
+ parameters to be logged regardless of filter
68
+ settings. Patched for Rails 2.2.1 or newer.
29
69
 
30
- * When using Rails 2.3 or older with Ruby 2.0 or newer,
31
- ActionController's filter_parameters behavior will silently fail
32
- and output all parameters to the log regardless of filtering
33
- options selected. Rails-futurizer will automatically patch this
34
- bug if you're using Rails 2.2.1 or newer.
70
+ * When Rails 2.2 - 3.0 is used with Ruby 2.0 or newer, saving an
71
+ ActiveRecord model that has an array assigned to one of its
72
+ has_many associations will raise the exception "undefined method
73
+ 'insert_record' for Array". Patched for all affected versions.
@@ -0,0 +1,18 @@
1
+ if Futurizer.detected? :activerecord => [">= 2.2.0", "< 3.1"], :ruby => ">= 2"
2
+ Futurizer.require_dependency "active_record"
3
+
4
+ module ActiveRecord
5
+ module Associations
6
+ class AssociationProxy
7
+ def send(method, *args)
8
+ if proxy_respond_to?(method, true)
9
+ super
10
+ else
11
+ load_target
12
+ @target.send(method, *args)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -11,5 +11,9 @@ module Futurizer
11
11
  def self.ruby_version
12
12
  Gem.ruby_version
13
13
  end
14
+
15
+ def self.rubygems_version
16
+ Gem::Version.new Gem::VERSION
17
+ end
14
18
  end
15
19
  end
@@ -1,3 +1,3 @@
1
1
  module Futurizer
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -12,7 +12,13 @@ module Futurizer
12
12
  end
13
13
 
14
14
  def self.current_version(resource)
15
- resource == :ruby ? SystemInfo.ruby_version : SystemInfo.gem_version(resource)
15
+ if resource == :ruby
16
+ SystemInfo.ruby_version
17
+ elsif resource == :rubygems
18
+ SystemInfo.rubygems_version
19
+ else
20
+ SystemInfo.gem_version resource
21
+ end
16
22
  end
17
23
  end
18
24
  end
@@ -7,6 +7,7 @@ module Futurizer
7
7
 
8
8
  def self.apply_patches
9
9
  require "futurizer/patches/actionpack/filter_parameters.rb"
10
+ require "futurizer/patches/activerecord/association_proxy.rb"
10
11
  end
11
12
 
12
13
  def self.require_dependency file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-futurizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Auton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-08 00:00:00.000000000 Z
11
+ date: 2014-03-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -63,6 +63,7 @@ files:
63
63
  - License.txt
64
64
  - README.md
65
65
  - lib/futurizer/patches/actionpack/filter_parameters.rb
66
+ - lib/futurizer/patches/activerecord/association_proxy.rb
66
67
  - lib/futurizer/system_info.rb
67
68
  - lib/futurizer/version.rb
68
69
  - lib/futurizer/version_detection.rb