Skip to content

Doesn't support dasherized keys #22

@averydev

Description

@averydev

The JSONAPI spec recommends using dasherized keys
http://jsonapi.org/recommendations/#naming

However, that breaks with jsonapi-utils.

jsonapi-resources 0.7
jsonapi-utils (~> 0.4.5)

With a request such as this:

{
  "data": {
    "id": "58",
    "type": "doctor-family-members",
    "links": {
      "self": "http://localhost:3000/doctor-family-members/58"
    },
    "attributes": {
      "doctor-id": 14,
      "family-member-id": 5,
      "min-visits": 2000,
      "avg-extra-visits": 3000,
      "doctor-name": "MATTHEW PARSONS"
    },
    "relationships": {
      "doctor": {
        "links": {
          "self": "http://localhost:3000/doctor-family-members/58/relationships/doctor",
          "related": "http://localhost:3000/doctor-family-members/58/doctor"
        }
      },
      "family-member": {
        "links": {
          "self": "http://localhost:3000/doctor-family-members/58/relationships/family-member",
          "related": "http://localhost:3000/doctor-family-members/58/family-member"
        }
      }
    }
  }
}

a param method of:
params.require(:data).require(:attributes).permit(:min_visits, :avg_extra_visits)

Shows min-visits and avg-extra-visits as not permitted.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions