mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
re: RuboCop: Bulk minor style corrections
This commit is contained in:
@@ -19,12 +19,13 @@ module ActionController
|
||||
end
|
||||
|
||||
def serialization_scope
|
||||
send(_serialization_scope) if _serialization_scope &&
|
||||
respond_to?(_serialization_scope, true)
|
||||
return unless _serialization_scope && respond_to?(_serialization_scope, true)
|
||||
|
||||
send(_serialization_scope)
|
||||
end
|
||||
|
||||
def get_serializer(resource, options = {})
|
||||
if !use_adapter?
|
||||
unless use_adapter?
|
||||
warn 'ActionController::Serialization#use_adapter? has been removed. '\
|
||||
"Please pass 'adapter: false' or see ActiveSupport::SerializableResource.new"
|
||||
options[:adapter] = false
|
||||
|
||||
@@ -125,10 +125,9 @@ module ActiveModel
|
||||
self.root = instance_options[:root]
|
||||
self.scope = instance_options[:scope]
|
||||
|
||||
scope_name = instance_options[:scope_name]
|
||||
if scope_name && !respond_to?(scope_name)
|
||||
define_singleton_method scope_name, lambda { scope }
|
||||
end
|
||||
return if !(scope_name = instance_options[:scope_name]) || respond_to?(scope_name)
|
||||
|
||||
define_singleton_method scope_name, -> { scope }
|
||||
end
|
||||
|
||||
def success?
|
||||
|
||||
@@ -36,7 +36,7 @@ module ActiveModelSerializers
|
||||
target = is_a?(Module) ? "#{self}." : "#{self.class}#"
|
||||
msg = ["NOTE: #{target}#{name} is deprecated",
|
||||
replacement == :none ? ' with no replacement' : "; use #{replacement} instead",
|
||||
"\n#{target}#{name} called from #{ActiveModelSerializers.location_of_caller.join(":")}"]
|
||||
"\n#{target}#{name} called from #{ActiveModelSerializers.location_of_caller.join(':')}"]
|
||||
warn "#{msg.join}."
|
||||
send old, *args, &block
|
||||
end
|
||||
|
||||
@@ -21,7 +21,7 @@ module ActiveModelSerializers
|
||||
|
||||
# Defaults to the downcased model name and updated_at
|
||||
def cache_key
|
||||
attributes.fetch(:cache_key) { "#{self.class.name.downcase}/#{id}-#{updated_at.strftime("%Y%m%d%H%M%S%9N")}" }
|
||||
attributes.fetch(:cache_key) { "#{self.class.name.downcase}/#{id}-#{updated_at.strftime('%Y%m%d%H%M%S%9N')}" }
|
||||
end
|
||||
|
||||
# Defaults to the time the serializer file was modified.
|
||||
|
||||
Reference in New Issue
Block a user