João Moura
37114e9d5b
removing unnecessary root parameter on fragment cache
2015-06-13 15:48:33 -03:00
Lachlan Sylvester
97e82c3eb7
use model name to determine the type
2015-06-13 19:45:46 +10:00
João Moura
de23501995
Merge pull request #949 from edwardloveall/el-870-fix
...
Don't pass serializer option to associated serializers
2015-06-13 03:01:25 -03:00
João Moura
6251b90d25
Merge pull request #902 from cristianbica/serializer_file_digest
...
Added serializer file digest to the cache_key
2015-06-12 18:56:43 -03:00
Benjamin Fleischer
14439aada4
Use model that doesn't fail with race condition
...
For some reason, the post would sometimes be serialized as
"{\"id\":\"1\",
+ \"type\":\"posts\", \"attributes\":{\"title\":\"New Post\",\"body\":\"Body\"},
\"comments\":[{\"id\":1,\"body\":\"ZOMG A COMMENT\"}],
\"blog\":{\"id\":999,\"name\":\"Custom blog\"},
\"author\":{\"id\":1,\"name\":\"Joao Moura.\"}}"
instead of:
"{\"id\":1,
- \"title\":\"New Post\",\"body\":\"Body\",
\"comments\":[{\"id\":1,\"body\":\"ZOMG A COMMENT\"}],
\"blog\":{\"id\":999,\"name\":\"Custom blog\"},\
"author\":{\"id\":1,\"name\":\"Joao Moura.\"}}"
To reproduce prior to this PR:
SEED=55284 rake
1) Failure:
ActionController::Serialization::ExplicitSerializerTest#test_render_using_explicit_each_serializer
[active_model_serializers/test/action_controller/explicit_serializer_test.rb:139]:
--- expected
+++ actual
@@ -1 +1 @@
-"{\"id\":1,\"title\":\"New
Post\",\"body\":\"Body\",\"comments\":[{\"id\":1,\"body\":\"ZOMG A
COMMENT\"}],\"blog\":{\"id\":999,\"name\":\"Custom
blog\"},\"author\":{\"id\":1,\"name\":\"Joao Moura.\"}}"
+"{\"id\":\"1\",\"type\":\"posts\",\"attributes\":{\"title\":\"New
Post\",\"body\":\"Body\"},\"comments\":[{\"id\":1,\"body\":\"ZOMG A
COMMENT\"}],\"blog\":{\"id\":999,\"name\":\"Custom
blog\"},\"author\":{\"id\":1,\"name\":\"Joao Moura.\"}}"
137 runs, 211 assertions, 1 failures, 0 errors, 0 skips
rake aborted!
Command failed with status (1): [ruby -I"lib:test"
-r./test/test_helper.rb
"/$HOME/.rvm/rubies/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_test_loader.rb"
"test/action_controller/adapter_selector_test.rb"
"test/action_controller/explicit_serializer_test.rb"
"test/action_controller/json_api_linked_test.rb"
"test/action_controller/rescue_from_test.rb"
"test/action_controller/serialization_scope_name_test.rb"
"test/action_controller/serialization_test.rb"
"test/adapter/fragment_cache_test.rb"
"test/adapter/json/belongs_to_test.rb"
"test/adapter/json/collection_test.rb"
"test/adapter/json/has_many_test.rb"
"test/adapter/json_api/belongs_to_test.rb"
"test/adapter/json_api/collection_test.rb"
"test/adapter/json_api/has_many_embed_ids_test.rb"
"test/adapter/json_api/has_many_explicit_serializer_test.rb"
"test/adapter/json_api/has_many_test.rb"
"test/adapter/json_api/has_one_test.rb"
"test/adapter/json_api/linked_test.rb" "test/adapter/json_test.rb"
"test/adapter/null_test.rb" "test/adapter_test.rb"
"test/array_serializer_test.rb" "test/serializers/adapter_for_test.rb"
"test/serializers/associations_test.rb"
"test/serializers/attribute_test.rb"
"test/serializers/attributes_test.rb" "test/serializers/cache_test.rb"
"test/serializers/configuration_test.rb"
"test/serializers/fieldset_test.rb"
"test/serializers/generators_test.rb" "test/serializers/meta_test.rb"
"test/serializers/options_test.rb"
"test/serializers/serializer_for_test.rb"
"test/serializers/urls_test.rb" ]
/$HOME/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in
`eval'
/$HOME/.rvm/gems/ruby-2.2.2/bin/ruby_executable_hooks:15:in
`<main>'
Tasks: TOP => default => test
(See full trace by running task with --trace)
2015-06-12 11:27:28 -05:00
Benjamin Fleischer
a5554e0d9f
Use a different controller in different tests
...
A number of test were defining and using the same controller
MyController = Class.new(ActionController::Base)
which was causing some state to leak across tests.
2015-06-12 11:27:20 -05:00
Santiago Pastorino
460150fef2
Fix No such file or directory tmp/cache issue in tests
2015-06-10 21:23:23 -03:00
Santiago Pastorino
4752e6723a
Make resource generator invoke serializer generator
2015-06-10 20:45:33 -03:00
Santiago Pastorino
e117615465
This should be MAJOR >= 4
2015-06-10 20:26:37 -03:00
Santiago Pastorino
3fb55db1cd
Load generators on test_helper and avoid repetead code
2015-06-10 20:26:37 -03:00
Santiago Pastorino
cbc7f114c0
Move generators test to it's own directory
2015-06-10 20:26:24 -03:00
Edward Loveall
0f0ef2baf5
Don't pass serializer option to associated serializers
...
Fixes #870
Commit af81a40 introduced passing a serializer's 'options'
along to its associated model serializers.
Thus, an explicit 'each_serializer' passed to render for a
singular resource would be passed on as the implicit 'serializer'
for its associations.
With @bf4
2015-06-10 18:20:34 -04:00
João Moura
7b0a85fdda
Merge pull request #936 from insphire/fix-meta-with-custom-root
...
Include meta when using json adapter with custom root
2015-06-08 19:55:03 -03:00
Thiago Fernandes Massa
5fac4d8f33
Update poro.rb
2015-06-05 10:50:35 +02:00
Chris Branson
d34bba07b9
Ensure the adapters honor a custom root option and include meta when required
2015-06-04 17:33:41 +01:00
João Moura
a40df8fd3d
reverting PR #909 and adding json api usage advise on readme
2015-05-27 18:35:00 -03:00
Benedikt Deicke
4f576a1463
Adjusts JsonApi adapter to serialize relationships in a nested relationships hash
2015-05-21 16:35:35 +02:00
Benedikt Deicke
ca41901fb8
Adjusts JsonApi adapter to serialize attributes in a nested attributes hash
2015-05-21 16:23:01 +02:00
João Moura
5f05944826
Merge pull request #918 from aceofsales/rescue_from
...
Adding rescue_with_handler to clear state
2015-05-20 23:39:45 -03:00
Guillermo Iguaran
f7fb4dbb98
Merge pull request #909 from joaomdmoura/json-api-default
...
Defining Json-API Adapter as Default
2015-05-20 20:50:19 -05:00
Ryan Schlesinger
a5db2c52c5
Clearer exception description
2015-05-20 09:19:32 -07:00
Ryan Schlesinger
9355416ad0
Add rescue_from handler to clear state
...
Fixes #917
2015-05-19 17:23:29 -07:00
groyoh
5393e5d235
Prevent possible duplicated attributes
...
Calling ActiveModel::Serializer.attributes or ActiveModel::Serializer.attribute
methods multiple times won't create duplicated attributes anymore.
2015-05-18 22:42:10 +02:00
João Moura
d981ee5106
Merge pull request #880 from groyoh/serializer-inheritance
...
Inabling subclasses serializers to inherit attributes
2015-05-18 11:34:10 -03:00
groyoh
a794a06fa5
Fixed #911
2015-05-17 22:47:44 +02:00
João Moura
9b502a4ae0
changing tests name to support new default adapter
2015-05-11 16:23:38 -03:00
João Moura
2c9c36e21f
adding json_api as default adapter
2015-05-10 03:58:18 -03:00
João Moura
46ae776175
Merge pull request #897 from imanel/patch-1
...
Allow to define custom serializer for given class
2015-05-10 03:28:14 -03:00
Cristian Bica
7a62d31777
Added serializer file digest to the cache_key
...
Fixes #901
2015-05-06 08:37:18 +03:00
João Moura
ece43f344a
Merge pull request #892 from groyoh/fix-json-nil-association
...
Fixed a bug that appeared when json adapter serialize a nil association
2015-05-05 11:04:26 -03:00
Bernard Potocki
c91b649504
Allow to define custom serializer for given class by defining #serializer_class method in serialized object's class. Resolves #515 .
2015-05-03 17:47:52 +02:00
Attila Domokos
bd06647b31
Adding a test to cover 'meta' and 'meta_key' attr_readers
2015-04-30 22:17:19 -05:00
groyoh
5dcdfaaef3
Fixed a bug that appeared when json adapter serialize a nil association
2015-04-28 22:20:21 +02:00
João Moura
fc6276cab8
Merge pull request #888 from groyoh/fix-action-controller-test-name
...
Changed duplicated test name in action controller test
2015-04-28 12:09:02 -03:00
Justin Aiken
cf1c57d2a9
Remove unused method
2015-04-27 16:53:36 -06:00
groyoh
1ef2badb32
Changed duplicated test name in action controller test
2015-04-27 21:22:28 +02:00
João Moura
49e41cb83c
adding tests order config
2015-04-27 15:45:49 -03:00
Yohan Robert
02ffff599f
Serializers now inherit attributes
2015-04-23 13:25:36 +02:00
Alexandre de Oliveira
168c36fc7d
Merge pull request #810 from joaomdmoura/fragment-cache
...
Adding Fragment Cache to AMS
2015-04-21 17:57:55 -03:00
João Moura
792fb8a905
Adding Fragment Cache to AMS
...
It's an upgrade based on the new Cache implementation #693 .
It allows to use the Rails conventions to cache
specific attributes or associations.
It's based on the Cache Composition implementation.
2015-04-05 18:19:57 -03:00
Yohan Robert
6a0564a241
Fixed a bug that appears when a nil association is included
2015-04-03 12:50:05 +02:00
Mateo Murphy
5e560ddbef
Fix skipped test and add test for duplicate links
2015-03-24 19:46:30 -04:00
Mateo Murphy
9480b567ef
Refactor TestUser in SerializationScopeNameTest
...
Use the same base class we use for other test models
2015-03-23 13:44:30 -04:00
Mateo Murphy
b6951809b0
Add test for required fields
2015-03-22 20:43:57 -04:00
Mateo Murphy
946d1dba14
Remove debug include
2015-03-22 20:43:56 -04:00
Mateo Murphy
33f3a88ba0
Implement included and id and type as per spec
2015-03-22 20:43:56 -04:00
Mateo Murphy
d82c599c68
Always use plural for linked types
...
Although spec is agnostic about inflection rules, examples given are plural
2015-03-22 20:43:11 -04:00
Mateo Murphy
0f55f21266
Update format of links
2015-03-22 20:41:20 -04:00
Mateo Murphy
da86747a3e
Use symbol for root in jsonapi, fix tests
2015-03-22 20:38:29 -04:00
Guillermo Iguaran
b68d7f4826
Merge pull request #852 from mateomurphy/serializer-options-fix
...
Fix options merge order in `each_association`
2015-03-22 18:54:07 -05:00