Module: JSONAPI::ResourceActions::TypeValidation
- Extended by:
- ActiveSupport::Concern
- Included in:
- JSONAPI::ResourceActions
- Defined in:
- lib/json_api/controllers/concerns/resource_actions/type_validation.rb
Instance Method Summary collapse
Instance Method Details
#validate_resource_id! ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/json_api/controllers/concerns/resource_actions/type_validation.rb', line 20 def validate_resource_id! return unless @resource_class requested = jsonapi_id expected = params[:id].to_s return if requested == expected render_id_mismatch_error(expected, requested) and return end |
#validate_resource_type! ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/json_api/controllers/concerns/resource_actions/type_validation.rb', line 8 def validate_resource_type! return unless @resource_class return if params[:relationship_name].present? requested = jsonapi_type expected = resource_type return if requested == expected return if valid_sti_subtype?(requested) render_type_mismatch_error(expected, requested) and return end |