mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
re: RuboCop - replace rocket style hashes
This commit is contained in:
@@ -23,7 +23,7 @@ module ActiveModelSerializers
|
||||
# This hook is run after the action_controller railtie has set the configuration
|
||||
# based on the *environment* configuration and before any config/initializers are run
|
||||
# and also before eager_loading (if enabled).
|
||||
initializer 'active_model_serializers.set_configs', :after => 'action_controller.set_configs' do
|
||||
initializer 'active_model_serializers.set_configs', after: 'action_controller.set_configs' do
|
||||
ActiveModelSerializers.logger = Rails.configuration.action_controller.logger
|
||||
ActiveModelSerializers.config.perform_caching = Rails.configuration.action_controller.perform_caching
|
||||
# We want this hook to run after the config has been set, even if ActionController has already loaded.
|
||||
|
||||
@@ -53,7 +53,7 @@ module ActiveModelSerializers::Jsonapi
|
||||
def self.parser
|
||||
lambda do |body|
|
||||
data = JSON.parse(body)
|
||||
data = { :_json => data } unless data.is_a?(Hash)
|
||||
data = { _json: data } unless data.is_a?(Hash)
|
||||
data.with_indifferent_access
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,11 +2,11 @@ module Rails
|
||||
module Generators
|
||||
class SerializerGenerator < NamedBase
|
||||
source_root File.expand_path('../templates', __FILE__)
|
||||
check_class_collision :suffix => 'Serializer'
|
||||
check_class_collision suffix: 'Serializer'
|
||||
|
||||
argument :attributes, :type => :array, :default => [], :banner => 'field:type field:type'
|
||||
argument :attributes, type: :array, default: [], banner: 'field:type field:type'
|
||||
|
||||
class_option :parent, :type => :string, :desc => 'The parent class for the generated serializer'
|
||||
class_option :parent, type: :string, desc: 'The parent class for the generated serializer'
|
||||
|
||||
def create_serializer_file
|
||||
template 'serializer.rb.erb', File.join('app/serializers', class_path, "#{file_name}_serializer.rb")
|
||||
|
||||
Reference in New Issue
Block a user