-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error with namespaced relations with inclusions #16
Comments
Interesting.. I'd like to build a test to replicate this failure so I can verify it's truly resolved. |
@AtomGrafiks i believe you have a typo in the Location Serializer. The optional key 'serializer' expects a symbol and by convention assumes all serializers are in the same namespace. class Cluster::LocationSerializer
include FastJsonapi::ObjectSerializer
attributes :begin_at, :end_at
has_one :workspace, serializer: :workspace # (serializer hash not required in your case)
has_one :user, serializer: :user # (serializer hash not required in your case)
end In your specific case, you dont even have to provide the key 'serializer' since your relationship name and serializer name are same.
|
Ah, interesting, thanks ;) |
* Add params to set_id block arguments Pull request Netflix#331 added a block to the ObjectSerializer.set_id class method, which allows passing a block to the set_id method. Currently this block takes only one argument `record`: ``` set_id do |record| "#{record.name.downcase}-#{record.id}" end ``` This PR adds another argument `params` to the block: ``` set id do |record, params| params[:admin] ? record.id : "#{record.name.downcase}-#{record.id}" end ``` This customization can be useful in situation where we serve different clients that may need different IDs. One nice side effect is also that the `set_id` method has the same method signature as the `attribute` method. * Update the README
An error is perform when includes an associations has_one
call:
Error :
The text was updated successfully, but these errors were encountered: