Lucas Hosseini

Results 151 comments of Lucas Hosseini

Could you provide a failing spec for this if you have one handy? I'll investigate and fix right now.

`has_many :employees` (plural) vs `create(:position, employee: employee1)` (singular `employee`) Does the created resource actually respond to `.employees` (plural)?

You are right. The way things work currently is that relationship blocks are `eval`d in a specific context in which exposures are forwarded. A quick workaround for your situation would...

So one possible solution to your problem @richmolj would be to forward to base object upon missing method. What do you think?

I doubt it would be a bottleneck but I'll try to hack something together and we'll benchmark it.

@ezekg You are right – at the moment links are built eagerly (only the related objects are constructed lazily). However, a simple fix for your use-case (that would be in-line...

@ezekg See https://github.com/json-api/json-api/issues/1134 and related issues for an overview of why exposing the related link as `/posts/3/user` is the most flexible solution.

@ezekg Would you mind writing a regression test for this?

@dylanlewis89 Yes it does, you just have to call `extend JSONAPI::Serializable::Resource::KeyFormat` in your serializer in order to enable it.

@dylanlewis89 Sorry, I obviously meant `JSONAPI::Serializable::Resource::ConditionalFields` rather than `JSONAPI::Serializable::Resource::KeyFormat`.