Skip to content

Commit

Permalink
Correctly stop rubocop from complaining
Browse files Browse the repository at this point in the history
  • Loading branch information
albus522 committed Aug 8, 2014
1 parent 505132b commit fbac48d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/delayed/psych_ext.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
if defined?(ActiveRecord)
ActiveRecord::Base.class_eval do
# rubocop:disable BlockNesting
if instance_methods.include?(:encode_with)
def encode_with_override(coder) # rubocop:disable BlockNesting
def encode_with_override(coder)
encode_with_without_override(coder)
coder.tag = "!ruby/ActiveRecord:#{self.class.name}" if coder.respond_to?(:tag=)
end
alias_method :encode_with_without_override, :encode_with
alias_method :encode_with, :encode_with_override
else
def encode_with(coder) # rubocop:disable BlockNesting
def encode_with(coder)
coder['attributes'] = attributes
coder.tag = "!ruby/ActiveRecord:#{self.class.name}" if coder.respond_to?(:tag=)
end
Expand Down

0 comments on commit fbac48d

Please sign in to comment.