Alex Zherdev
5d3f56f0a4
Use SHA1 instead of MD5 for caching
2019-10-15 13:12:36 -07:00
Wasif Hossain
55a6b23cd8
Configure ActionDispatch::Response#content_type behavior on Rails 6+
...
in order to retain old behavior,
set `config.action_dispatch.return_only_media_type_on_content_type`
to true
it can also be configured by setting
`ActionDispatch::Response.return_only_media_type_on_content_type`
2019-08-23 23:46:29 +06:00
Wasif Hossain
82ad288fc7
Add support for Rails 6.0.0 on Travis
2019-08-21 22:21:31 +06:00
Wasif Hossain
2581fe0362
Lookup fieldset using either string or symbol
2019-07-17 15:51:15 +06:00
Rafael Gaspar
beffbb2bd3
Follows inheritance with a namespace
...
Co-authored-by: Rafael Gaspar <rafael.gaspar@me.com>
Co-authored-by: Darryl Pogue <darryl@dpogue.ca>
Co-authored-by: Artin Boghosian <artinboghosian@gmail.com>
2019-07-10 11:41:32 -07:00
Mark Havekes
22849c0399
fix include in failing test
2019-06-14 09:52:16 +02:00
Mark Havekes
28a172e66a
return nil if id is nil
2019-06-11 14:42:13 +02:00
Mark Havekes
4b0c230d76
add failing test and suggestion
2019-06-04 10:27:02 +02:00
Anton K
4a4a0f263e
Stick to bundle < 2
2019-05-01 22:58:09 +03:00
Wasif Hossain
c77fddadd4
Mention current rails version for #2327 ruby2.6/rails4.2 monkeypatch
2019-04-23 15:18:18 +06:00
Wasif Hossain
807e160b9c
Add missing frozen string literal comment
2019-04-23 04:34:09 +06:00
Wasif Hossain
a9cb097109
Refactoring
2019-04-23 04:34:02 +06:00
Benjamin Fleischer
06fcd34807
Follows https://github.com/rails-api/active_model_serializers/pull/2100
2019-04-23 04:33:56 +06:00
Wasif Hossain
5d122f2922
Fix rubocop offenses
2019-04-23 02:06:12 +06:00
Wasif Hossain
0aa1ed93a4
Configure sqlite3 to use ~> 1.4 for rails 6+
2019-04-22 23:22:28 +06:00
Kyle Keesling
912af7ef91
update test fixture schema to use timestamps instead of timestamp
...
- discovered via @wasifhossain
- Update CHANGELOG.md
2019-03-14 11:00:45 -04:00
Kyle Keesling
6fbeb9a93e
Fix deprecation warnings on Rails 6
...
takes into account suggestions from @bf4
2019-03-13 09:52:54 -04:00
cintamani
26bba194d0
Ensure that CacheVersioning is setted up only in the context of relevant tests
2019-02-05 15:50:43 +00:00
Benjamin Fleischer
6fd5c66837
Update test/cache_test.rb
...
Co-Authored-By: cintamani <cintamani.puddu@gmail.com>
2019-02-05 15:42:21 +00:00
cintamani
7ff2ac64b7
Update test/cache_test.rb
2019-02-01 17:44:09 +00:00
Wasif Hossain
3d0b5acc37
Test cache expiration in collection on update of a record
2019-02-01 10:04:49 +06:00
cintamani
192c86ab2a
Update test/cache_test.rb
2019-01-29 16:00:18 +00:00
cintamani
7dbb583873
Update cache_test.rb
...
Re-run tests on appveyor. Based on https://github.com/rails-api/active_model_serializers/pull/1168/files looks like there are some config issue in that environment causing this.
2019-01-29 16:00:18 +00:00
cintamani
70604bbae7
Only set cache_versioning to true on rails versions when relevant
2019-01-29 16:00:18 +00:00
cintamani
7f751fc1f7
Add test coverage and changelog
2019-01-29 16:00:18 +00:00
Krzysztof Rybka
873cf4add2
Add frozen_string_literal pragma to ruby files
2018-12-17 16:54:56 +01:00
Benjamin Fleischer
238d7921ec
Lint per rubocop
2018-11-01 14:51:18 -05:00
Benjamin Fleischer
127b04ba33
Add failing test for reflection thread safety bug
2018-11-01 13:57:07 -05:00
Konstantin Munteanu
0d3999c36d
Support conditions in link statements
2018-10-25 09:45:34 +02:00
Dzmitry
db4e5267fd
Fix the bug that serializer could not be found if the association's serializer is namespaced but the model is not
...
[fix #2295 ]
2018-10-20 15:42:11 +03:00
Benjamin Fleischer
f5f5d4db9e
Fix Rails master
2018-10-10 09:39:48 -05:00
quake wang
a9ea81a831
resolve collection cache error
2017-11-19 11:33:48 -06:00
Benjamin Fleischer
b41451c9bf
Make tests pass
2017-11-13 08:36:23 -06:00
Benjamin Fleischer
00a47d3da4
Prove CI broken ( #2220 )
...
* Remove appveyor rubygems/bundler stuff
* Try specifying different jdbc adapter
* Attempt to fix failing JRuby test I cannot reproduce
```
bundle exec rake ci
Picked up _JAVA_OPTIONS: -Xmx2048m -Xms512m
/home/travis/.rvm/rubies/jruby-9.1.9.0/bin/jruby -w -I"lib:lib:test" -r./test/test_helper.rb -w -I"/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/rake-11.3.0/lib" "/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "test/**/*_test.rb"
ActiveModelSerializers::Adapter::JsonApi::PaginationLinksTest#test_raises_descriptive_error_when_serialization_context_unset [/home/travis/build/rails-api/active_model_serializers/test/adapter/json_api/pagination_links_test.rb:186]:
[] exception expected, not
Class: <ActiveModelSerializers::Adapter::JsonApi::PaginationLinks::MissingSerializationContextError>
Message: <" JsonApi::PaginationLinks requires a ActiveModelSerializers::SerializationContext.\n Please pass a ':serialization_context' option or\n override CollectionSerializer#paginated? to return 'false'.\n">
---Backtrace---
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/json_api/pagination_links.rb:14:in `block in initialize'
org/jruby/RubyHash.java:1187:in `fetch'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/json_api/pagination_links.rb:13:in `initialize'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/json_api.rb:520:in `pagination_links_for'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/json_api.rb:147:in `success_document'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/json_api.rb:59:in `serializable_hash'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/adapter/base.rb:59:in `as_json'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/serializable_resource.rb:8:in `as_json'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:69:in `block in as_json'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:117:in `call'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:555:in `block in compile'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:505:in `call'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:498:in `block in around'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:343:in `block in simple'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:22:in `block in instrument_rendering'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:79:in `block in notify_render'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `block in instrument'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications/instrumenter.rb:20:in `instrument'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/notifications.rb:164:in `instrument'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:78:in `notify_render'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:21:in `block in instrument_rendering'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:97:in `tag_logger'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:20:in `block in instrument_rendering'
org/jruby/RubyBasicObject.java:1724:in `instance_exec'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:441:in `block in make_lambda'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:342:in `block in simple'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:497:in `block in around'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:505:in `call'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:92:in `__run_callbacks__'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:778:in `_run_render_callbacks'
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/activesupport-4.2.10/lib/active_support/callbacks.rb:81:in `run_callbacks'
/home/travis/build/rails-api/active_model_serializers/lib/active_model_serializers/logging.rb:68:in `block in as_json'
/home/travis/build/rails-api/active_model_serializers/test/adapter/json_api/pagination_links_test.rb:187:in `block in test_raises_descriptive_error_when_serialization_context_unset'
Command failed with status (1): [ruby -w -I"lib:lib:test" -r./test/test_helper.rb -w -I"/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/rake-11.3.0/lib" "/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/rake-11.3.0/lib/rake/rake_test_loader.rb" "test/**/*_test.rb" ]
/home/travis/build/rails-api/active_model_serializers/vendor/bundle/jruby/2.3.0/gems/rake-11.3.0/exe/rake:27:in `<main>'
Tasks: TOP => ci => default => test
(See full trace by running task with --trace)
```
2017-11-13 08:34:56 -06:00
Benjamin Fleischer
3c5e11bb0f
Merge pull request #2216 from rails-api/serialize_resource_with_nil_id
...
Fix: Serialize resource type for unpersisted records (blank id)
2017-11-01 10:36:22 -05:00
Benjamin Fleischer
196216b250
Merge pull request #2212 from rails-api/remove_legacy_embeds
...
Remove legacy has_many_embed_ids test [ci skip]
2017-10-31 14:54:02 -05:00
Benjamin Fleischer
51f2643f40
Style
2017-10-31 14:48:27 -05:00
Benjamin Fleischer
9745a2f735
Fix: ResourceIdentifier.for_type_with_id can serialize unpersisted resources
2017-10-31 14:47:55 -05:00
Benjamin Fleischer
5916014b48
Fix: resource object identifier with nil id excludes id
2017-10-31 14:34:30 -05:00
Benjamin Fleischer
92dde58f5f
Assert serializer-defined types are not inflected
2017-10-31 14:31:33 -05:00
Benjamin Fleischer
82e90091fd
Put the similar jsonapi type tests together
2017-10-31 14:29:09 -05:00
Benjamin Fleischer
b439fe69c6
Refactor jsonapi type/id tests to be more explicit
2017-10-31 14:26:05 -05:00
Benjamin Fleischer
e3480345e3
Merge pull request #2211 from rails-api/polymorphic_relationships_require_serializer_instance
...
JSON:API relationship tests no longer show v0.10.5 regression
2017-10-31 13:49:18 -05:00
Joe Meredith
c6a14c9eac
Fail if collection type cannot be inferred with json adapter ( #2210 )
2017-10-30 13:37:37 -04:00
Benjamin Fleischer
1fd324947f
Remove legacy has_many_embed_ids test
2017-10-29 22:50:59 -05:00
Benjamin Fleischer
0fcb8a6cce
Fix polymorphic belongs_to tests; passes on v0.10.5
2017-10-29 19:26:14 -05:00
Dennis Stumm
4d7c2457d7
Fix deserialization of polymorphic relationships ( #2200 )
...
* Classify the relationship type for polymorphic associations
2017-10-07 17:03:38 -05:00
Benjamin Fleischer
6a7d864605
Fix CI on 0-10-stable ( #2181 )
...
* Loosen pry, pry-byebug depencency
```
Resolving dependencies...
byebug-9.1.0 requires ruby version >= 2.2.0, which is
incompatible with the current version, ruby 2.1.10p492
```
* Adjust nokogiri version constraint for CI
Update appveyor Ruby to 2.3 to work around:
```
Gem::InstallError: nokogiri requires Ruby version < 2.5, >= 2.2.
An error occurred while installing nokogiri (1.8.0), and Bundler cannot continue.
Make sure that `gem install nokogiri -v '1.8.0'` succeeds before bundling.
```
and not 2.4 since:
https://ci.appveyor.com/project/bf4/active-model-serializers/build/1.0.1052-fix_ci/job/0q3itabsnvnxr83u
```
nokogiri-1.6.8.1-x86-mingw32 requires ruby version < 2.4, which is incompatible with the current version, ruby 2.4.1p111
```
* Include rails gem in Gemfile
(For Rails5)
In Rails5, checking for Rails::Railtie is better
* Rails5 test env requires Rails.application.class.name
rails-42d09f6b49da/railties/lib/rails/application.rb
```ruby
def secret_key_base
if Rails.env.test? || Rails.env.development?
Digest::MD5.hexdigest self.class.name
```
* Reformat exclude matrix to be easier to read
* Simplify jruby-travis config per rails/rails
* Organize .travis.yml per rails/rails
* Allow JRuby failure on Rails 5+; try rails-5 db adapter branch
https://github.com/jruby/activerecord-jdbc-adapter/issues/708
```
uninitialized constant ActiveRecord::ConnectionAdapters::Column::Format
```
see https://travis-ci.org/rails-api/active_model_serializers/jobs/277112008
2017-09-19 05:27:02 -04:00
Alexandre de Oliveira
1e4d117b99
Merge pull request #2149 from mecampbellsoup/more-pagination-links-by-default
...
Always include self, first, last pagination links
2017-06-14 15:47:30 -03:00
mecampbellsoup
402883d84f
Fix Travis lint offenses
2017-06-14 13:35:00 -04:00