lib/active_model/serializer.rb in cheap_ams-0.10.5 vs lib/active_model/serializer.rb in cheap_ams-0.10.6

- old
+ new

@@ -11,11 +11,10 @@ autoload :Associations autoload :Fieldset include Configuration include Associations - # Matches # "c:/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>'" # AND # "/c/git/emberjs/ember-crm-backend/app/serializers/lead_serializer.rb:1:in `<top (required)>'" # AS @@ -30,11 +29,10 @@ /x class << self attr_accessor :_attributes attr_accessor :_attributes_keys - attr_accessor :_urls attr_accessor :_cache attr_accessor :_fragmented attr_accessor :_cache_key attr_accessor :_cache_only attr_accessor :_cache_except @@ -43,11 +41,10 @@ end def self.inherited(base) base._attributes = self._attributes.try(:dup) || [] base._attributes_keys = self._attributes_keys.try(:dup) || {} - base._urls = [] base._cache_digest = digest_caller_file(caller.first) super end def self.attributes(*attrs) @@ -85,18 +82,10 @@ @_cache_only = options.delete(:only) @_cache_except = options.delete(:except) @_cache_options = (options.empty?) ? nil : options end - def self.url(attr) - @_urls.push attr - end - - def self.urls(*attrs) - @_urls.concat attrs - end - def self.serializer_for(resource, options = {}) if resource.respond_to?(:serializer_class) resource.serializer_class elsif resource.respond_to?(:to_ary) config.array_serializer @@ -144,30 +133,16 @@ def json_key @root || object.class.model_name.to_s.underscore end - def id - object.id if object - end - - def json_api_type - if config.jsonapi_resource_type == :plural - object.class.model_name.plural - else - object.class.model_name.singular - end - end - def attributes(options = {}) attributes = if options[:fields] self.class._attributes & options[:fields] else self.class._attributes.dup end - - attributes += options[:required_fields] if options[:required_fields] attributes.each_with_object({}) do |name, hash| unless self.class._fragmented hash[name] = send(name) else