ga-wdi-boston / rails-api-one-to-many

Other
0 stars 92 forks source link

Show relationship serializers #4

Open laurenfazah opened 8 years ago

jrhorn424 commented 8 years ago

Can we talk about the differences between has_many :books and attributes ... :books?

I think this may have changed semantically between older versions of AMS and new versions.

Does anyone know the difference? They appear functionally equivalent.

payne-chris-r commented 7 years ago

From slack: Chris Payne [1:44 PM] What do we think about serializing out full relationship objects instead of just their IDs? I know ember prefers just IDs, and it’s something that I’ve grown accustomed to (perhaps because of Ember), but I also think it makes them think more critically about what information their APIs are divulging instead of just dumping it all and filtering it later. has flashbacks of a resource returning a user object including password_digest that owns it

Antony Donovan [1:50 PM] It depends :tm:

Chris Payne [34 minutes ago] How often do they have “properly created serializers”

Antony Donovan [34 minutes ago] Sorry. Use case specific.

Antony Donovan [34 minutes ago] The developers? Almost never.

Antony Donovan [33 minutes ago] During WDI. We can't cover everything :tm:

Chris Payne [33 minutes ago] Would you be ok with “use just IDs by default*”

Chris Payne [33 minutes ago] *unless you know what you’re doing

Chris Payne [33 minutes ago] or *have a defendable reason

Antony Donovan [32 minutes ago] It can make crafting a client with the browser-template more challenging.

Chris Payne [30 minutes ago] Because: .then(//go get relationship things which may be an array of all the things you need to get?)

Antony Donovan [23 minutes ago] Yes.

payne-chris-r commented 7 years ago

What if we had them add :books, but .pluck attributes that they wanted to serialize out rather than defaulting to everything?