Class: JSONAPI::Resources::Matchers::CheckSerialization
- Inherits:
-
Object
- Object
- JSONAPI::Resources::Matchers::CheckSerialization
- Defined in:
- lib/jsonapi/resources/matchers/services/check_serialization.rb
Constant Summary collapse
- MESSAGE =
[ "`:primary_key` is nil.", "In this scenario, jsonapi-resources does not", "include the attributes in order for this matcher to work.", "To get this working, initialize the model with a primary key set.", ].join(" ")
Class Method Summary collapse
Class Method Details
.call(resource) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/jsonapi/resources/matchers/services/check_serialization.rb', line 11 def self.call(resource) return true if resource.try(:id).present? fail( ArgumentError, MESSAGE.gsub(":primary_key", resource.class._primary_key.to_s) ) end |