lib/calculated_attributes.rb in calculated_attributes-0.2.0 vs lib/calculated_attributes.rb in calculated_attributes-0.3.0

- old
+ new

@@ -3,9 +3,14 @@ # Include patches. require 'calculated_attributes/rails_patches' require 'calculated_attributes/arel_patches' raise "Unsupported ActiveRecord version: #{ActiveRecord::VERSION::MAJOR}" unless [3, 4, 5].include? ActiveRecord::VERSION::MAJOR -require "calculated_attributes/rails_#{ActiveRecord::VERSION::MAJOR}_patches" + +if Gem::Version.new(ActiveRecord::VERSION::STRING) <= Gem::Version.new('5.1.4') + require "calculated_attributes/rails_#{ActiveRecord::VERSION::MAJOR}_patches" +else + require 'calculated_attributes/rails_5_2_patches' +end # Include model code. require 'calculated_attributes/model_methods'