Skip to content

Commit a45b255

Browse files
committed
Update readme.
1 parent 3b1e085 commit a45b255

1 file changed

Lines changed: 5 additions & 10 deletions

File tree

README.md

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ And then execute:
1616
```
1717
$ bundle
1818
```
19-
Or install it manually as:
20-
```
21-
$ gem install jsonapi-rails
22-
```
2319

2420
## Usage
2521

@@ -28,29 +24,28 @@ $ gem install jsonapi-rails
2824
Example:
2925
```ruby
3026
# app/serializable/serializable_user.rb
31-
class SerializableUser < JSONAPI::Serializable::Model
27+
class SerializableUser < JSONAPI::Serializable::Resource
3228
type 'users'
3329

3430
attribute :name
3531
attribute :email do
36-
"#{@model.name}@foo.bar"
32+
"#{@object.name}@foo.bar"
3733
end
3834

3935
has_many :posts do
40-
# data is auto-inferred
41-
link(:related) { @url_helpers.user_posts(@model) }
36+
link(:related) { @url_helpers.user_posts(@object) }
4237
meta foo: :bar
4338
end
4439

4540
has_many :comments do
46-
data do
41+
resources do
4742
@user.comments.order(:desc)
4843
end
4944
end
5045

5146
has_many :reviews, Foo::Bar::SerializableRev
5247

53-
link(:self) { @url_helpers.user_url(@model.id) }
48+
link(:self) { @url_helpers.user_url(@object.id) }
5449
meta do
5550
{ foo: 'bar' }
5651
end

0 commit comments

Comments
 (0)