Skip to content

Commit e620c9e

Browse files
authored
Merge pull request #183 from kbrock/class_vars
Minor tweaks to class vars and spec running modifications
2 parents 74d042b + 0a0800c commit e620c9e

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

lib/active_record/virtual_attributes.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def type
3838
ActiveRecord::Type.register(:symbol, Type::Symbol)
3939

4040
included do
41-
class_attribute :virtual_attributes_to_define, :instance_accessor => false
42-
self.virtual_attributes_to_define = {}
41+
class_attribute :virtual_attributes_to_define, :instance_accessor => false, :default => {}
4342
end
4443

4544
module ClassMethods

lib/active_record/virtual_attributes/virtual_delegates.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ module VirtualDelegates
1010
extend ActiveSupport::Concern
1111

1212
included do
13-
class_attribute :virtual_delegates_to_define, :instance_accessor => false
14-
self.virtual_delegates_to_define = {}
13+
class_attribute :virtual_delegates_to_define, :instance_accessor => false, :default => {}
1514
end
1615

1716
module ClassMethods

lib/active_record/virtual_attributes/virtual_fields.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ def call
170170
class Branch
171171
prepend(Module.new {
172172
# from branched.rb 7.0
173+
# not going to modify rails code for rubocops
174+
# rubocop:disable Lint/AmbiguousOperatorPrecedence
173175
def grouped_records
174176
h = {}
175177
polymorphic_parent = !root? && parent.polymorphic?
@@ -184,6 +186,7 @@ def grouped_records
184186
end
185187
h
186188
end
189+
# rubocop:enable Lint/AmbiguousOperatorPrecedence
187190

188191
# branched.rb 7.0
189192
def preloaders_for_reflection(reflection, reflection_records)

spec/spec_helper.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
if ENV['CI']
22
require 'simplecov'
3-
SimpleCov.start
3+
SimpleCov.start do
4+
add_filter %r{^/spec/}
5+
end
46
end
57

68
$LOAD_PATH.unshift(File.dirname(__FILE__) + '/../lib')

0 commit comments

Comments
 (0)