Skip to content

Commit 98f4c2b

Browse files
committed
Update README.md
1 parent 7bfc8c7 commit 98f4c2b

File tree

1 file changed

+35
-35
lines changed

1 file changed

+35
-35
lines changed

README.md

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -165,55 +165,55 @@ The block is evaluated within the serializer instance, so it has access to the `
165165
Many other formatting and customizations are possible by overriding any of the following instance methods on your serializers.
166166

167167
```ruby
168-
# Override this to customize the JSON:API "id" for this object.
169-
# Always return a string from this method to conform with the JSON:API spec.
170-
def id
171-
object.id.to_s
172-
end
168+
# Override this to customize the JSON:API "id" for this object.
169+
# Always return a string from this method to conform with the JSON:API spec.
170+
def id
171+
object.id.to_s
172+
end
173173
```
174174
```ruby
175-
# Override this to customize the JSON:API "type" for this object.
176-
# By default, the type is the object's class name lowercased, pluralized, and dasherized,
177-
# per the spec naming recommendations: http://jsonapi.org/recommendations/#naming
178-
# For example, 'MyApp::LongCommment' will become the 'long-comments' type.
179-
def type
180-
object.class.name.demodulize.tableize.dasherize
181-
end
175+
# Override this to customize the JSON:API "type" for this object.
176+
# By default, the type is the object's class name lowercased, pluralized, and dasherized,
177+
# per the spec naming recommendations: http://jsonapi.org/recommendations/#naming
178+
# For example, 'MyApp::LongCommment' will become the 'long-comments' type.
179+
def type
180+
object.class.name.demodulize.tableize.dasherize
181+
end
182182
```
183183
```ruby
184-
# Override this to customize how attribute names are formatted.
185-
# By default, attribute names are dasherized per the spec naming recommendations:
186-
# http://jsonapi.org/recommendations/#naming
187-
def format_name(attribute_name)
188-
attribute_name.to_s.dasherize
189-
end
184+
# Override this to customize how attribute names are formatted.
185+
# By default, attribute names are dasherized per the spec naming recommendations:
186+
# http://jsonapi.org/recommendations/#naming
187+
def format_name(attribute_name)
188+
attribute_name.to_s.dasherize
189+
end
190190
```
191191
```ruby
192-
# The opposite of format_name. Override this if you override format_name.
193-
def unformat_name(attribute_name)
194-
attribute_name.to_s.underscore
195-
end
192+
# The opposite of format_name. Override this if you override format_name.
193+
def unformat_name(attribute_name)
194+
attribute_name.to_s.underscore
195+
end
196196
```
197197
```ruby
198-
# Override this to provide resource-object metadata.
199-
# http://jsonapi.org/format/#document-structure-resource-objects
200-
def meta
201-
end
198+
# Override this to provide resource-object metadata.
199+
# http://jsonapi.org/format/#document-structure-resource-objects
200+
def meta
201+
end
202202
```
203203
```ruby
204-
def self_link
205-
"/#{type}/#{id}"
206-
end
204+
def self_link
205+
"/#{type}/#{id}"
206+
end
207207
```
208208
```ruby
209-
def relationship_self_link(attribute_name)
210-
"#{self_link}/links/#{format_name(attribute_name)}"
211-
end
209+
def relationship_self_link(attribute_name)
210+
"#{self_link}/links/#{format_name(attribute_name)}"
211+
end
212212
```
213213
```ruby
214-
def relationship_related_link(attribute_name)
215-
"#{self_link}/#{format_name(attribute_name)}"
216-
end
214+
def relationship_related_link(attribute_name)
215+
"#{self_link}/#{format_name(attribute_name)}"
216+
end
217217
```
218218

219219
## Relationships

0 commit comments

Comments
 (0)