We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 225c3e3 commit 2364a0aCopy full SHA for 2364a0a
1 file changed
README.md
@@ -193,6 +193,18 @@ class ContactResource < JSONAPI::Resource
193
end
194
```
195
196
+##### Attribute Delegation
197
+
198
+Normally resource attributes map to an attribute on the model of the same name. Using the `delegate` option allows a resource
199
+attribute to map to a differently named model attribute. For example:
200
201
+```ruby
202
+class ContactResource < JSONAPI::Resource
203
+ attribute :name_first, delegate: :first_name
204
+ attribute :name_last, delegate: :last_name
205
+end
206
+```
207
208
##### Fetchable Attributes
209
210
By default all attributes are assumed to be fetchable. The list of fetchable attributes can be filtered by overriding
0 commit comments