lib/jsonapi/basic_resource.rb in jsonapi-resources-0.10.0.beta6 vs lib/jsonapi/basic_resource.rb in jsonapi-resources-0.10.0.beta7
- old
+ new
@@ -420,15 +420,17 @@
class << self
def inherited(subclass)
subclass.abstract(false)
subclass.immutable(false)
subclass.caching(_caching)
+ subclass.cache_field(_cache_field) if @_cache_field
subclass.singleton(singleton?, (_singleton_options.dup || {}))
subclass.exclude_links(_exclude_links)
- subclass.paginator(_paginator)
+ subclass.paginator(@_paginator)
subclass._attributes = (_attributes || {}).dup
subclass.polymorphic(false)
+ subclass.key_type(@_resource_key_type)
subclass._model_hints = (_model_hints || {}).dup
unless _model_name.empty? || _immutable
subclass.model_name(_model_name, add_model_hint: (_model_hints && !_model_hints[_model_name].nil?) == true)
@@ -753,11 +755,11 @@
def key_type(key_type)
@_resource_key_type = key_type
end
def resource_key_type
- @_resource_key_type ||= JSONAPI.configuration.resource_key_type
+ @_resource_key_type || JSONAPI.configuration.resource_key_type
end
# override to all resolution of masked ids to actual ids. Because singleton routes do not specify the id this
# will be needed to allow lookup of singleton resources. Alternately singleton resources can override
# `verify_key`
@@ -876,11 +878,11 @@
def _default_primary_key
@_default_primary_key ||=_model_class.respond_to?(:primary_key) ? _model_class.primary_key : :id
end
def _cache_field
- @_cache_field ||= JSONAPI.configuration.default_resource_cache_field
+ @_cache_field || JSONAPI.configuration.default_resource_cache_field
end
def _table_name
@_table_name ||= _model_class.respond_to?(:table_name) ? _model_class.table_name : _model_name.tableize
end
@@ -896,10 +898,10 @@
def _allowed_sort
@_allowed_sort ||= {}
end
def _paginator
- @_paginator ||= JSONAPI.configuration.default_paginator
+ @_paginator || JSONAPI.configuration.default_paginator
end
def paginator(paginator)
@_paginator = paginator
end