Commit Graph

357 Commits

Author SHA1 Message Date
João Moura
b78126565c Merge pull request #954 from bf4/encapsulate_serialization
Encapsulate serialization in ActiveModel::SerializableResource
2015-07-31 03:09:58 -03:00
João Moura
7bc16666fe Merge pull request #972 from bf4/capture_app_warnings
Capture app warnings on test run
2015-07-30 22:24:08 -03:00
João Moura
438d8f411a Merge pull request #1019 from baojjeu/master
Improve README.md
2015-07-28 21:32:01 -03:00
Baozi Wu
672618447e Update README.md 2015-07-27 02:44:53 +08:00
Baozi Wu
e388be9c01 Update README.md 2015-07-26 16:01:52 +08:00
Benjamin Fleischer
df140293d3 Remove unused controller rescue_with_handler
Per
https://github.com/rails-api/active_model_serializers/pull/954#discussion_r32589882

Ref 917, 918
2015-07-23 11:06:11 -05:00
Benjamin Fleischer
a66df3009a Encapsulate serialization in ActiveModel::SerializableResource
Usage: ActiveModel::SerializableResource.serialize(resource, options)
2015-07-23 11:05:23 -05:00
João Moura
e1c25e86e3 Merge pull request #998 from joaomdmoura/changing_root_to_model_class_name
Changing root to model class name
2015-07-23 02:18:47 -04:00
João Moura
9817a5b595 updating tests 2015-07-23 02:11:34 -04:00
João Moura
418721302b defining json_key(root) as model class name 2015-07-23 02:11:34 -04:00
João Moura
6266b6a002 Merge pull request #1006 from bf4/inflector-testing
Fix adapter inflection bug for api -> API
2015-07-20 23:20:00 -04:00
João Moura
4c3114236d Merge pull request #1016 from bf4/fix_railtie_missing_require
require rails/railtie before subclassing Rails::Railtie
2015-07-19 12:51:52 -04:00
Benjamin Fleischer
ed23a37de9 require rails/railtie before subclassing Rails::Railtie 2015-07-17 14:16:30 -05:00
Benjamin Fleischer
4359026c0e Handle inflecting api to s/API/Api without side-effects 2015-07-17 14:09:13 -05:00
João Moura
7066b1f6cb Merge pull request #1013 from vyrak/root-option
Root option with empty array support
2015-07-17 12:48:35 -04:00
João Moura
357d0d4e36 Merge pull request #994 from joaomdmoura/master
Starting Docs structure
2015-07-16 23:36:08 -04:00
João M. D. Moura
63436c73e8 minor updates and TYPOs 2015-07-16 23:29:03 -04:00
vyrak bunleang
1b09d0ec42 array serializer uses root option for json_key if available 2015-07-16 15:34:19 -06:00
vyrak bunleang
1d31096600 include old implicit serialization custom root tests with failing empty array test 2015-07-16 15:32:09 -06:00
Marek Pietrucha
e5ccb8e4dd root option is working (fixed #986) 2015-07-16 15:32:09 -06:00
João Moura
456f9158ca removing useless exmaple lines 2015-07-16 10:18:04 -04:00
João Moura
420f7959c0 creating initial general and how to docs 2015-07-16 10:18:04 -04:00
João Moura
b0a2e9f5e2 starting initial docs structure 2015-07-16 10:18:04 -04:00
João Moura
d7140949cd Merge pull request #1007 from jiajiawang/array_serializer_json_key_fix
Bug fix for ArraySerializer json_key
2015-07-15 23:49:25 -04:00
Jiajia Wang
91ffec41af Add test for ArraySerializer json_key method
test json key when resource is empty
2015-07-16 11:11:14 +10:00
Jiajia Wang
7faa5e8e2e Bug fix for ArraySerializer json_key
When the resource is a zero result query,
i.e. post_comments = PostComment.where("1=0")
the json_key will become 'postcomments' rather than 'post_comments'.
Using 'underscore' instead of 'downcase' fixes the error.
2015-07-15 10:11:06 +10:00
Benjamin Fleischer
e7174a7820 Capture and print app warnings on test run
Configure not to fail the test, for now
2015-07-14 01:05:26 -05:00
João Moura
954e4c51fe Merge pull request #1003 from Rodrigora/fix-transient-test-failures
Fix transient test failures
2015-07-14 01:35:45 -04:00
Rodrigo Ra
851d121ea8 fix transient test failures 2015-07-13 22:44:04 -03:00
João Moura
775737619a Merge pull request #996 from bf4/serializer_lint
Add linter for serializable resource
2015-07-13 19:37:39 -04:00
Rob McFadzean
506739d4fb Added a (failing) test for when inflecting API 2015-07-10 11:23:55 +09:30
Benjamin Fleischer
28174e297d Add linter for serializable resource 2015-07-09 11:20:19 -05:00
João Moura
0201f2dd2a Merge pull request #990 from joaomdmoura/adding-json-api-meta-test
Adding json-api meta test
2015-07-08 10:39:36 -03:00
João Moura
7fb94234a8 adding json-api meta test help 2015-07-08 10:15:14 -03:00
João Moura
90fb1cf809 Merge pull request #984 from Rodrigora/add-key-option-to-associations
Add option "key" to serializer associations
2015-07-06 10:43:45 -03:00
Rodrigo Ra
df63b59512 Add key option to serializer associations 2015-07-05 19:47:58 -03:00
João Moura
ac1991fd6b Merge pull request #982 from bf4/typo
Fix typo
2015-07-02 19:06:32 -03:00
João Moura
6a122dacac Merge pull request #981 from bf4/remove_to_param
Remove unused PORO#to_param
2015-07-02 18:54:51 -03:00
Benjamin Fleischer
58a237ead1 Fix typo 2015-07-02 16:35:27 -05:00
Benjamin Fleischer
1bf2825909 Remove unused PORO#to_param 2015-07-02 16:34:10 -05:00
João Moura
952d8adcdc Merge pull request #978 from regonn/fix-generators-template
fix generators template bug
2015-07-02 00:31:55 -03:00
João Moura
a895de76bf Merge pull request #975 from GriffinHeart/fix-virtual-values
Fixes virtual value not being used
2015-07-01 23:04:54 -03:00
regonn
59a177e8b5 add serializer template test 2015-07-01 13:42:16 +09:00
regonn
5f300a0d42 fix generators template bug 2015-06-30 18:16:27 +09:00
Hugo Almeida
f25071ca70 Fixes virtual value not being used 2015-06-29 10:48:12 +09:00
João Moura
059409b0b9 Merge pull request #970 from Rodrigora/fix-test-race-conditions
Fix transient tests failures
2015-06-26 15:13:04 -03:00
Rodrigo Ra
7412c8d1c8 Fix transient tests failures 2015-06-26 09:33:53 -03:00
João Moura
03ac94b9b4 Merge pull request #962 from joaomdmoura/render-array-objects
Rendering objects that doesn't have serializers
2015-06-26 02:32:04 -03:00
Benjamin Fleischer
17d560eae4 Account for different handling of symbol keys in Rails 4.0
Comparing as a JSON string vs. as the Hash that is convert to JSON
works around the different Hash representations.

This likely has to do with the introduction of
config.action_dispatch.perform_deep_munge in Rails 4.1
See Rails issue 13420

  1) Failure:
  ActiveModel::Serializer::Adapter::Json::HasManyTestTest#test_has_many_with_no_serializer
  [active_model_serializers/test/adapter/json/has_many_test.rb:36]:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -{:id=>42, :tags=>[{"attributes"=>{"id"=>1, "name"=>"#hash_tag"}}]}
  +{:id=>42, :tags=>[{"attributes"=>{:id=>1, :name=>"#hash_tag"}}]}

  2) Failure:
  ActiveModel::Serializer::AssociationsTest#test_has_many_with_no_serializer
  [active_model_serializers/test/serializers/associations_test.rb:74]:
  --- expected
  +++ actual
  @@ -1 +1 @@
  -[{"attributes"=>{"name"=>"#hashtagged"}}]
  +[{"attributes"=>{:name=>"#hashtagged"}}]
2015-06-26 02:16:35 -03:00
João Moura
741c4a4b51 updating tests to work with new virtual_value implementation 2015-06-26 02:16:35 -03:00