Skip to content

Commit 1e47c16

Browse files
authored
Merge branch 'master' into patch-1
2 parents bd50ae9 + ab824e2 commit 1e47c16

File tree

4 files changed

+30
-19
lines changed

4 files changed

+30
-19
lines changed

.travis.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ rvm:
77
- 2.2.6
88
- 2.3.3
99
- ruby-head
10-
- jruby-9.0.4.0
10+
- jruby-9.1.5.0 # is precompiled per http://rubies.travis-ci.org/
1111
- jruby-head
1212

1313
jdk:
1414
- oraclejdk8
1515

16+
before_install:
17+
- gem update --system
18+
- rvm @global do gem uninstall bundler -a -x
19+
- rvm @global do gem install bundler -v 1.13.7
1620
install: bundle install --path=vendor/bundle --retry=3 --jobs=3
1721
cache:
1822
directories:
@@ -35,13 +39,13 @@ matrix:
3539
exclude:
3640
- rvm: 2.1
3741
env: RAILS_VERSION=master
38-
- rvm: jruby-9.0.4.0
42+
- rvm: jruby-9.1.5.0
3943
env: RAILS_VERSION=master
4044
- rvm: jruby-head
4145
env: RAILS_VERSION=master
4246
- rvm: 2.1
4347
env: RAILS_VERSION=5.0
44-
- rvm: jruby-9.0.4.0
48+
- rvm: jruby-9.1.5.0
4549
env: RAILS_VERSION=5.0
4650
- rvm: jruby-head
4751
env: RAILS_VERSION=5.0

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Misc:
1717
- [#2021](https://github.com/rails-api/active_model_serializers/pull/2021) Make test attributes explicit. Tests have Model#associations. (@bf4)
1818
- [#1981](https://github.com/rails-api/active_model_serializers/pull/1981) Fix relationship link documentation. (@groyoh)
1919
- [#2035](https://github.com/rails-api/active_model_serializers/pull/2035) Document how to disable the logger. (@MSathieu)
20+
- [#2039](https://github.com/rails-api/active_model_serializers/pull/2039) Documentation fixes. (@biow0lf)
2021

2122
### [v0.10.4 (2017-01-06)](https://github.com/rails-api/active_model_serializers/compare/v0.10.3...v0.10.4)
2223

appveyor.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version: '{build}'
1+
version: 1.0.{build}-{branch}
22

33
skip_tags: true
44

@@ -7,17 +7,23 @@ environment:
77
matrix:
88
- ruby_version: "Ruby21"
99
- ruby_version: "Ruby21-x64"
10-
- ruby_version: "jruby-9.0.0.0"
1110

1211
cache:
1312
- vendor/bundle
1413

1514
install:
1615
- SET PATH=C:\%ruby_version%\bin;%PATH%
17-
- gem install bundler
16+
- gem update --system
17+
- gem uninstall bundler -a -x
18+
- gem install bundler -v 1.13.7
1819
- bundle env
1920
- bundle install --path=vendor/bundle --retry=3 --jobs=3
2021

22+
before_test:
23+
- ruby -v
24+
- gem -v
25+
- bundle -v
26+
2127
test_script:
2228
- bundle exec rake ci
2329

docs/howto/add_pagination_links.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,13 @@ If you are using `JSON` adapter, pagination links will not be included automatic
7777
Add this method to your base API controller.
7878

7979
```ruby
80-
def pagination_dict(object)
80+
def pagination_dict(collection)
8181
{
82-
current_page: object.current_page,
83-
next_page: object.next_page,
84-
prev_page: object.prev_page, # use object.previous_page when using will_paginate
85-
total_pages: object.total_pages,
86-
total_count: object.total_count
82+
current_page: collection.current_page,
83+
next_page: collection.next_page,
84+
prev_page: collection.prev_page, # use collection.previous_page when using will_paginate
85+
total_pages: collection.total_pages,
86+
total_count: collection.total_count
8787
}
8888
end
8989
```
@@ -117,18 +117,18 @@ ex.
117117
You can also achieve the same result if you have a helper method that adds the pagination info in the meta tag. For instance, in your action specify a custom serializer.
118118

119119
```ruby
120-
render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attributes(@post)
120+
render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attributes(@posts)
121121
```
122122

123123
```ruby
124124
#expects pagination!
125-
def meta_attributes(resource, extra_meta = {})
125+
def meta_attributes(collection, extra_meta = {})
126126
{
127-
current_page: resource.current_page,
128-
next_page: resource.next_page,
129-
prev_page: resource.prev_page, # use resource.previous_page when using will_paginate
130-
total_pages: resource.total_pages,
131-
total_count: resource.total_count
127+
current_page: collection.current_page,
128+
next_page: collection.next_page,
129+
prev_page: collection.prev_page, # use collection.previous_page when using will_paginate
130+
total_pages: collection.total_pages,
131+
total_count: collection.total_count
132132
}.merge(extra_meta)
133133
end
134134
```

0 commit comments

Comments
 (0)