lib/jsonapionify/api/resource/definitions/attributes.rb in jsonapionify-0.0.1.pre vs lib/jsonapionify/api/resource/definitions/attributes.rb in jsonapionify-0.9.0
- old
+ new
@@ -4,11 +4,11 @@
def self.extended(klass)
klass.class_eval do
extend JSONAPIonify::InheritedAttributes
extend JSONAPIonify::Types
inherited_array_attribute :attributes
- delegate :attributes, to: :class
+ delegate :id_attribute, :attributes, to: :class
context(:fields, readonly: true) do |context|
should_error = false
fields = (context.request.params['fields'] || {}).each_with_object(self.class.api.fields) do |(type, fields), field_map|
type_sym = type.to_sym
@@ -18,10 +18,10 @@
attribute.read? && attribute.name == field
end
attribute ? field_list << attribute.name : error(:field_not_permitted, type, field) && (should_error = true)
end
end
- raise error_exception if should_error
+ raise Errors::RequestError if should_error
fields
end
end
end