Conversation
|
I feel like these two changes are quite distinct. Could we (at least going forward) break these things out into multiple PRs? |
dlcarter
left a comment
There was a problem hiding this comment.
Agree with removing Optimizer. It was always a 'sugar-on-top' kind of feature, and it's not achieving its intended goals, so agree with removing it until we can get it right.
| value = object.public_send(association_name) | ||
| return value if value.nil? | ||
| view = options[:view] || :default | ||
| options[:blueprint].prepare(value, view_name: view, local_options: local_options) |
There was a problem hiding this comment.
So, I'm not sure if you intended this or not, but a side effect of this code is that it makes it so that you now always have to have a Blueprint for every association. I think that could be considered a reasonable tradeoff, but I want to make sure we're explicitly making that decision.
There was a problem hiding this comment.
Ya, so I do not understand how it would work if the associated object does not have a blueprint.
There was a problem hiding this comment.
I am for having the requirement that any object being serialized within this system must use a blueprint... I've personally been bitten by having both AMS and jbuilder for the same resource far too many times to try to fashion some coexistence between any of them.
|
@AllPurposeName Yes, I can separate the removal of Optimizer into another PR. |
Require that association accept a blueprint so that we can serialize associated objects with the correct blueprint.
8f06bb4 to
4480097
Compare
|
removal of optimizer has been cherry-picked out into #61 |
| association :vehicles, blueprint: vehicle_blueprint | ||
| end | ||
| end | ||
| it('returns json with association') { should eq(result) } |
There was a problem hiding this comment.
This is so implicit and confusing. Maybe we should switch to MiniTest 😜
There was a problem hiding this comment.
ok i admin i over-utilized some of rspec's "features" that does make it quite implicit. I'll make more explicit specs going forward =D
Fix association
To fix association, we require that association accept a blueprint so that we can serialize
associated objects with the correct blueprint.