From d6b1b1c81f4cbad4d17b63ac0ced83e0d4c185cd Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 24 Jan 2017 13:27:20 +0200 Subject: [PATCH 1/4] Fix typo --- docs/howto/add_pagination_links.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/howto/add_pagination_links.md b/docs/howto/add_pagination_links.md index 7c486fbd..eec974cf 100644 --- a/docs/howto/add_pagination_links.md +++ b/docs/howto/add_pagination_links.md @@ -117,7 +117,7 @@ ex. 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. ```ruby -render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attributes(@post) +render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attributes(@posts) ``` ```ruby From 3c6eb57ee945bcde7857f575ea3895e19302269f Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 24 Jan 2017 13:28:50 +0200 Subject: [PATCH 2/4] Replace object with collection. Replace resource with collection. --- docs/howto/add_pagination_links.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/howto/add_pagination_links.md b/docs/howto/add_pagination_links.md index eec974cf..69d290c2 100644 --- a/docs/howto/add_pagination_links.md +++ b/docs/howto/add_pagination_links.md @@ -77,13 +77,13 @@ If you are using `JSON` adapter, pagination links will not be included automatic Add this method to your base API controller. ```ruby -def pagination_dict(object) +def pagination_dict(collection) { - current_page: object.current_page, - next_page: object.next_page, - prev_page: object.prev_page, # use object.previous_page when using will_paginate - total_pages: object.total_pages, - total_count: object.total_count + current_page: collection.current_page, + next_page: collection.next_page, + prev_page: collection.prev_page, # use collection.previous_page when using will_paginate + total_pages: collection.total_pages, + total_count: collection.total_count } end ``` @@ -122,13 +122,13 @@ render json: @posts, each_serializer: PostPreviewSerializer, meta: meta_attribut ```ruby #expects pagination! -def meta_attributes(resource, extra_meta = {}) +def meta_attributes(collection, extra_meta = {}) { - current_page: resource.current_page, - next_page: resource.next_page, - prev_page: resource.prev_page, # use resource.previous_page when using will_paginate - total_pages: resource.total_pages, - total_count: resource.total_count + current_page: collection.current_page, + next_page: collection.next_page, + prev_page: collection.prev_page, # use collection.previous_page when using will_paginate + total_pages: collection.total_pages, + total_count: collection.total_count }.merge(extra_meta) end ``` From 775ad66ffd1bbe0806ed7a7eb5831858da273cb0 Mon Sep 17 00:00:00 2001 From: Igor Zubkov Date: Tue, 24 Jan 2017 15:12:25 +0200 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b025a61b..ad6232e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ Misc: - [#2021](https://github.com/rails-api/active_model_serializers/pull/2021) Make test attributes explicit. Tests have Model#associations. (@bf4) - [#1981](https://github.com/rails-api/active_model_serializers/pull/1981) Fix relationship link documentation. (@groyoh) +- [#2039](https://github.com/rails-api/active_model_serializers/pull/2039) Documentation fixes. (@biow0lf) ### [v0.10.4 (2017-01-06)](https://github.com/rails-api/active_model_serializers/compare/v0.10.3...v0.10.4) From 9ccdb15610a200870135635fd346e895916a0096 Mon Sep 17 00:00:00 2001 From: Benjamin Fleischer Date: Thu, 26 Jan 2017 13:52:46 -0600 Subject: [PATCH 4/4] Fix JRuby build on CI, with a suggestion from Travis CI support (#2040) * Fix JRuby build on CI, with a suggestion from Travis CI support per https://github.com/hanami/helpers/pull/97/commits/13f30e287c315f93141c2da005d4f08dec0d16dc per https://twitter.com/jodosha/status/823522145745731586 --- .travis.yml | 10 +++++++--- appveyor.yml | 12 +++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 0cd358e4..9aff1edc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,12 +7,16 @@ rvm: - 2.2.6 - 2.3.3 - ruby-head - - jruby-9.0.4.0 + - jruby-9.1.5.0 # is precompiled per http://rubies.travis-ci.org/ - jruby-head jdk: - oraclejdk8 +before_install: + - gem update --system + - rvm @global do gem uninstall bundler -a -x + - rvm @global do gem install bundler -v 1.13.7 install: bundle install --path=vendor/bundle --retry=3 --jobs=3 cache: directories: @@ -35,13 +39,13 @@ matrix: exclude: - rvm: 2.1 env: RAILS_VERSION=master - - rvm: jruby-9.0.4.0 + - rvm: jruby-9.1.5.0 env: RAILS_VERSION=master - rvm: jruby-head env: RAILS_VERSION=master - rvm: 2.1 env: RAILS_VERSION=5.0 - - rvm: jruby-9.0.4.0 + - rvm: jruby-9.1.5.0 env: RAILS_VERSION=5.0 - rvm: jruby-head env: RAILS_VERSION=5.0 diff --git a/appveyor.yml b/appveyor.yml index 9cd4fd0d..7ecfa13a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,4 +1,4 @@ -version: '{build}' +version: 1.0.{build}-{branch} skip_tags: true @@ -7,17 +7,23 @@ environment: matrix: - ruby_version: "Ruby21" - ruby_version: "Ruby21-x64" - - ruby_version: "jruby-9.0.0.0" cache: - vendor/bundle install: - SET PATH=C:\%ruby_version%\bin;%PATH% - - gem install bundler + - gem update --system + - gem uninstall bundler -a -x + - gem install bundler -v 1.13.7 - bundle env - bundle install --path=vendor/bundle --retry=3 --jobs=3 +before_test: + - ruby -v + - gem -v + - bundle -v + test_script: - bundle exec rake ci