Skip to content

Commit

Permalink
Rails 4 compatibility updates: add protected_attributes as a dependen…
Browse files Browse the repository at this point in the history
…cy so we can use attr_accessible
  • Loading branch information
mjbass committed Apr 23, 2016
1 parent d43538e commit b1e2f5c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 2.1.0 / 2016-04-23

* [ENHANCEMENT] Rails 4 compatibility

# 2.0.0 / 2014-01-20

* [ENHANCEMENT] Ruby 2.1.0 compatibility
Expand Down
4 changes: 1 addition & 3 deletions lib/vestal_versions/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ class Version < ActiveRecord::Base
# Associate polymorphically with the parent record.
belongs_to :versioned, :polymorphic => true

if ActiveRecord::VERSION::MAJOR == 3
attr_accessible :modifications, :number, :user, :version_tag, :reverted_from
end
attr_accessible :modifications, :number, :user, :version_tag, :reverted_from

# ActiveRecord::Base#changes is an existing method, so before serializing the +changes+ column,
# the existing +changes+ method is undefined. The overridden +changes+ method pertained to
Expand Down
18 changes: 0 additions & 18 deletions lib/vestal_versions/versions.rb
Original file line number Diff line number Diff line change
@@ -1,21 +1,3 @@
# See: https://github.com/rails/rails/issues/11026
if ActiveRecord::VERSION::MAJOR == 3 && ActiveRecord::VERSION::MINOR == 0 && RUBY_VERSION >= "2.0.0"
module ActiveRecord
module Associations
class AssociationProxy
def send(method, *args)
if proxy_respond_to?(method, true)
super
else
load_target
@target.send(method, *args)
end
end
end
end
end
end

module VestalVersions
# An extension module for the +has_many+ association with versions.
module Versions
Expand Down
7 changes: 4 additions & 3 deletions vestal_versions.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Gem::Specification.new do |gem|
gem.name = 'vestal_versions'
gem.version = '2.0.0'
gem.version = '2.1.0'

gem.authors = ['Steve Richert', "James O'Kelly", 'C. Jason Harrelson']
gem.email = ['steve.richert@gmail.com', 'dreamr.okelly@gmail.com', 'jason@lookforwardenterprises.com']
Expand All @@ -11,8 +11,9 @@ Gem::Specification.new do |gem|
gem.homepage = 'http://github.com/laserlemon/vestal_versions'
gem.license = 'MIT'

gem.add_dependency 'activerecord', '>= 3', '< 5'
gem.add_dependency 'activesupport', '>= 3', '< 5'
gem.add_dependency 'activerecord', '>= 4', '< 5'
gem.add_dependency 'activesupport', '>= 4', '< 5'
gem.add_dependency 'protected_attributes', '>= 1'

gem.add_development_dependency 'bundler', '~> 1.0'
gem.add_development_dependency 'rake', '~> 10.0'
Expand Down

0 comments on commit b1e2f5c

Please sign in to comment.