Commit Graph

845 Commits

Author SHA1 Message Date
Lucas Hosseini
2e87c8effe Fix comment. 2016-01-13 05:41:32 +01:00
Benjamin Fleischer
d466466660 Merge pull request #1427 from brigade/defunct-root-name
Remove defunct .root_name from test fixtures
2016-01-12 17:25:49 -06:00
Benjamin Fleischer
1d8226098f Merge pull request #1429 from brigade/association-inheritance
Remove unnecessary `dup` in `ActiveModel::Serializer::Associations#associate`
2016-01-12 17:25:41 -06:00
Ben Woosley
8ac1f107f4 Remove unnecessary dup in ActiveModel::Serializer::Associations#associate
The `_reflections` are duped on `inherited` - no need to `dup` them
with each addition.
2016-01-12 14:42:07 -08:00
Ben Woosley
251e33a0a1 Don't pluralize the CollectionSerializer#root for #json_key
One of three constituents is used to provide the
CollectionSerializer's #json_key:

1) the :root option - controlled by the caller
2) the #name of the first resource serializer - the root or
   underscored model name
3) the underscored #name of the resources object - generally
   equivalent to the underscored model name of #2

Of the three, only the latter 2 are out of the callers control, and
only the latter two are expected to be singular by default. Not
pluralizing the root gives the caller additional flexibility in
defining the desired root, whether conventionally plural,
unconventionally plural (e.g. objects_received:) or singular.
2016-01-12 09:32:43 -08:00
Lucas Hosseini
f6fe0c8aa3 Extract links and type-related methods to their own module. 2016-01-12 15:05:39 +01:00
Benjamin Fleischer
e3b9597d1a Remove warning capture; more trouble than worth 2016-01-11 23:48:40 -06:00
Benjamin Fleischer
2a171da6b9 Hack Minitest to make it less dependent on at_exit 2016-01-11 23:42:45 -06:00
Benjamin Fleischer
3133422654 Add .bundle/ to simplecov exclude 2016-01-11 23:42:45 -06:00
Ben Woosley
c8839f427b Remove defunct .root_name from test fixtures
Was removed elsewhere in
7847d05ecb
2016-01-11 17:16:00 -08:00
Benjamin Fleischer
34e5faa1c4 Merge pull request #1423 from brigade/tidy-tests
Tidy up the tests
2016-01-11 18:40:11 -06:00
Ben Woosley
0a6c133d25 Tidy up the tests
* Use assert_nil where appropriate
* Lead with the expected value in collection_serializer_test.rb, etc
 so that expected/actual in test failure messages are not reversed
2016-01-07 11:21:19 -08:00
Kory Tegman
aeefb6a080 revised docs to reflect the feedback 2016-01-06 22:21:19 -08:00
Kory Tegman
d153dfe2cd added documentation for adding custom root 2016-01-06 15:57:49 -08:00
Benjamin Fleischer
7d4f0c5c8a Merge branch 'bf4-consider_association_blocks' 2016-01-03 23:16:49 -06:00
Benjamin Fleischer
41ae5f7b6f Add 1356 to changelog; given credit for 1336 2016-01-03 23:14:38 -06:00
Benjamin Fleischer
81b1654c4e Merge pull request #1388 from bf4/restore_docs_from_older_releases
Restore docs from older releases
2016-01-03 23:10:41 -06:00
Benjamin Fleischer
b51a43262f Merge pull request #1370 from beauby/simplify-attributes
Simplify attributes handling.
2016-01-03 22:04:44 -06:00
Benjamin Fleischer
df594c630d Merge pull request #1410 from georgemillo/patch-1
Fix broken link in guides
2015-12-31 10:19:11 -06:00
George Millo
fdbc13c2de fix broken link 2015-12-31 16:44:54 +01:00
Lucas Hosseini
ccb05f11ef Add changelog. 2015-12-30 17:46:29 +01:00
Lucas Hosseini
77095f2a84 Add ActiveSupport::Autoload extension to Attribute. 2015-12-30 17:44:19 +01:00
Lucas Hosseini
a586a45863 Remove key from Attribute class. 2015-12-30 16:47:10 +01:00
Lucas Hosseini
7d24cbfd3d Extract latent Attribute object. 2015-12-30 16:47:10 +01:00
Lucas Hosseini
1d4b27f60f Improve attribute value computation. 2015-12-30 16:47:10 +01:00
Lucas Hosseini
ee0283cb57 Simplify attributes handling. 2015-12-30 16:47:10 +01:00
Lucas Hosseini
7bc66c5334 Merge pull request #1385 from bf4/remove_raw_minitest_test
Favor ActiveSupport::TestCase over Minitest::Test
2015-12-30 16:05:57 +01:00
Benjamin Fleischer
a4d5e3885a Merge pull request #1407 from CorainChicago/fix-link-on-Getting-Started.md
Fix link on Getting Started page [ci skip]
2015-12-29 23:07:38 -06:00
CorainChicago
66b068c542 fix link on Getting Started
update link on Getting Started to use the relative path
2015-12-29 22:52:22 -06:00
Benjamin Fleischer
d7de53ce30 Consider evaluating association in serializer context
For discussion:

Consider evaluating association in serializer context

That way, associations are really just anything that
can be conditionally included.  They no longer
have to actually be methods on the object or serializer.

e.g.

```diff
has_many :comments do
- last(1)
+ Comment.active.for_serialization(object).last(1)
end
```
2015-12-29 22:16:42 -06:00
Benjamin Fleischer
6f8f511eda Merge pull request #1405 from bf4/jruby9-update
Fix JRruby at 9.0.4.0 since TravisCI is using pre1 for some reason
2015-12-29 21:32:31 -06:00
Benjamin Fleischer
7f9c09998a Fix JRruby at 9.0.4.0 since TravisCI is using pre1 for some reason 2015-12-27 23:02:35 -06:00
Lucas Hosseini
12cd190cfc Merge pull request #1402 from beauby/extract-caching
Extract caching into its own module
2015-12-28 03:33:44 +01:00
Lucas Hosseini
fd06a8ad0d Extract caching into its own module. 2015-12-28 02:53:49 +01:00
Benjamin Fleischer
bb67735c79 Merge pull request #1398 from tricknotes/ruby-2.3
Test against Ruby 2.3.0 on Travis CI
2015-12-25 19:42:42 -06:00
Ryunosuke SATO
8df6d8acc1 Test against Ruby 2.3.0 on Travis CI 2015-12-26 05:13:52 +09:00
Benjamin Fleischer
cca723ae42 Merge pull request #1397 from bf4/rbx_is_unreliable_in_ci
Closes #1396.  RBX just causes unnecessary CI failures
2015-12-24 12:08:31 -06:00
Benjamin Fleischer
7688d3be90 Closes #1396. RBX just causes unnecessary CI failures 2015-12-24 11:55:11 -06:00
Benjamin Fleischer
4ac2908986 Merge pull request #1392 from bf4/add_jruby
Add JRuby 9000 to CI matrix
2015-12-24 11:37:53 -06:00
Benjamin Fleischer
b3bcafcb95 Merge pull request #1394 from maurogeorge/patch-16
Remove ActiveModelSerializers.silence_warnings dead code
2015-12-24 11:35:55 -06:00
Benjamin Fleischer
651aef0d74 Merge pull request #1395 from maurogeorge/patch-17
Drop Ruby 1.9.3 on AppVeyor
2015-12-23 17:58:10 -06:00
Mauro George
9031367b98 Drop Ruby 1.9.3 on AppVeyor 2015-12-23 19:39:15 -02:00
Mauro George
5fb7cceafb Remove ActiveModelSerializers.silence_warnings dead code
The ActiveModelSerializers.silence_warnings was used to avoid warnings on the
Ruby interpreter when define a private attr_acessor. This method is not used in
any part of the code and the recommend way to handle this case is to use
protected instead the silence_warnings [1].

This patch remove the method from the project, this way we avoid people using
this by mistake.

[1]: https://bugs.ruby-lang.org/issues/10967
2015-12-23 19:25:48 -02:00
Benjamin Fleischer
fd98349c54 Add some pre-history [ci skip] 2015-12-23 09:56:07 -06:00
Benjamin Fleischer
965e846bcb Add CHANGELOG from 0.9
https://github.com/rails-api/active_model_serializers/blob/0-9-stable/CHANGELOG.md
2015-12-23 09:45:45 -06:00
Benjamin Fleischer
24549b2eee Update CHANGELOG from 0.8
https://github.com/rails-api/active_model_serializers/blob/0-8-stable/CHANGELOG.md
2015-12-23 09:45:45 -06:00
Benjamin Fleischer
7d678844ae Add original design doc from 0.8
https://github.com/rails-api/active_model_serializers/blob/0-8-stable/DESIGN.textile
2015-12-23 09:45:45 -06:00
Benjamin Fleischer
94ca0e0701 Add JRuby 9000 to CI matrix 2015-12-22 23:54:29 -06:00
Benjamin Fleischer
d8b2b94a22 Merge pull request #1387 from bf4/add_rubocop_todos_to_contributing
Add rubocop todos to contributing [ci skip]
2015-12-22 21:43:39 -06:00
Benjamin Fleischer
63ed552e08 Merge pull request #1391 from maurogeorge/patch-15
Drop JRuby 1.9 from Travis
2015-12-22 21:32:47 -06:00