Ryunosuke SATO
447d96923f
Support Rails 4.2.0 with AMS 0.9
...
This patch is the same fixes as #655 and #663 for 0-9-stable branch.
2014-10-10 00:53:56 +09:00
Steve Klabnik
c19a254154
Merge pull request #632 from gauthier-delacroix/Default_namespace_inheritance
...
Default namespace option
2014-09-25 19:41:33 -04:00
Andrey Chernih
90343cea4d
Make sure render json: ..., each_serializer: ... is working with Enumerables
...
If you try to render Enumerable with custom `each_serializer` then it will render with default serializer instead:
```ruby
render json: sequel_scope, each_serializer: CustomSerializer
```
This commit fixes this behaviour. Most likely fixes https://github.com/rails-api/active_model_serializers/issues/664 as well
2014-09-25 16:59:47 +04:00
Gauthier Delacroix
5ae536cd7b
typo
2014-09-03 15:24:49 +02:00
Gauthier Delacroix
4d3d234dda
Fix default serializer option
2014-09-03 14:57:00 +02:00
Gauthier Delacroix
8514528db7
Allow default namespace inheritance
2014-09-03 12:41:30 +02:00
Steve Klabnik
922dd273c9
Merge pull request #620 from tristandunn/td-notifications
...
Avoid overwriting notifications for template assertions.
2014-08-31 20:02:08 -04:00
Tristan Dunn
610aeb2e92
Avoid overwriting notifications for template assertions.
2014-08-29 08:18:44 -05:00
Theodore Konukhov
26c0847563
- If a controller is in a namespace, serializer will be looked up in this namespace first.
...
- Serializers for associations will be looked up in a parent serializer's namespace first too.
- "Prefix" option for different versions of associations serializers. Example: has_many :users, as: :short -> ShortUserSerializer
TODO: tests, config option for enabling namespace lookup
2014-08-24 15:57:24 +02:00
Tema Bolshakov
699b378984
remove nested case
2014-08-20 12:35:23 +04:00
Tema Bolshakov
c5d9d97f26
Assert with serializer class
2014-08-20 12:34:34 +04:00
Tema Bolshakov and Dmitry Myaskovskiy
aa66592a80
Update docs
2014-08-18 18:24:07 +04:00
Tema Bolshakov and Dmitry Myaskovskiy
eaedcefa4e
Test::Unit assert_serializer implemented
...
So you can assert specific serializer to be used.
2014-08-18 18:04:51 +04:00
Jean Boussier
0d31e72d22
Allow users to opt-out from the ActionController extensions
2014-08-14 10:28:36 -04:00
Santiago Pastorino
ed9a5288f9
Revert "Merge branch 'context'"
...
This reverts commit 1bd8180a94 , reversing
changes made to 9bb32331f4 .
2014-01-07 15:02:09 -02:00
Adrian Mugnolo and Santiago Pastorino
dc32b5fc1b
Extract context build to a method
2014-01-06 15:50:53 -02:00
Adrian Mugnolo and Santiago Pastorino
0d8ef2b165
Nest scope under context option
2014-01-06 15:50:30 -02:00
Santiago Pastorino
78245b07bc
Move the default value to the options param
2014-01-03 20:02:43 -02:00
Adrian Mugnolo
1c9ab8fd24
Drop reference to self
2013-12-30 10:57:39 -02:00
Santiago Pastorino
616938dc63
Improve build_json_serializer readability a bit
2013-10-30 23:37:36 -02:00
Santiago Pastorino
df5ef33ae6
Allow to turn off ams
...
Closes #378
You can define now
```
def default_serializer_options
{ serializer: false }
end
```
2013-10-23 20:34:34 -02:00
Santiago Pastorino
aa23e811cc
Use controller name as root when serializing an array and not root is defined
2013-10-18 17:49:20 -02:00
Santiago Pastorino
8462a73f3a
Make render json work when not using AMS
2013-10-18 17:49:19 -02:00
Santiago Pastorino
29148cbe1c
Add AC::Serialization#serialization_scope as a class level method
2013-10-18 17:49:19 -02:00
Santiago Pastorino
01bc534976
Remove SerializerSupport
2013-10-18 17:49:17 -02:00
Santiago Pastorino
0d3b56e9cf
Implement AC integration
2013-10-18 17:49:17 -02:00
Santiago Pastorino
14f51f2ea9
Remove everything, rewrite of AMS starts here
2013-10-18 17:46:18 -02:00
Jason Kriss
4e762ee8b5
fix a couple typos
2013-04-18 13:39:14 -07:00
Jakub Arnold
1c1a4f7673
Fix serialization_scope to check for private/protected methods
...
The semantics of respond_to? on Ruby 2.0 have changed to return false for protected methods, which is usually the case for helpers like current_user.
2013-04-13 09:59:10 +03:00
Steve Klabnik
9551a97464
Revert 37b0690fb8.
...
This feature causes more problems than it solves.
2013-04-03 17:24:08 -07:00
beerlington
fd578fcf69
Refactor and consolidate serializer option setup
2013-03-19 22:21:41 -04:00
Michael Rykov
b3a6fa6334
Ensure that ActionController includes MimeResponds
2013-03-14 11:15:14 -07:00
Michael Rykov
37b0690fb8
Add a Responder to handle respond_with(resource)
2013-03-13 16:45:23 -07:00
Godfrey Chan
6581f8ce41
Fix default_serializer_options, closes #112 & #113
...
Allow options such as :serializer, :scope, :root etc to be set via
default_serializer_options and allow the inline options to override such
defaults.
2012-12-03 03:09:58 -08:00
Jean Boussier
06e8218193
Throw a descriptive error if attempting to serialize an array with Serializer not ArraySerializer #143
2012-11-22 23:27:18 -05:00
Ray Cohen
424dacb457
scope option to render takes precedence over serialization_scope
2012-07-28 21:06:15 -04:00
Tee Parham
0832e42917
add class attribute :root to ArraySerializer
...
You can now set the default behavior for Array serialization in a
single place
2012-07-14 21:44:23 -06:00
Andy Lindeman
47850677e9
Allows serialization_scope to be disabled with serialization_scope nil
2012-06-05 12:37:09 -04:00
Tee Parham
dd00e218b1
use :root option in render :json
...
ArraySerializer can now render arrays with no root
2012-05-18 12:45:43 -06:00
Yehuda Katz
56b61b1532
Add URL to serializers ( closes #61 )
...
Thanks so much to @vanstee for the initial
implementation!
2012-05-16 18:35:30 -07:00
Yehuda Katz
d5d917ea56
Don't require current_user
2012-04-30 17:18:51 -07:00
Jo Liss
67d5eefd8e
Simplify code
2012-04-17 15:54:34 +02:00
Carl Lerche
4e8a2af1ec
Allow passing in the serializer class from the render method
2012-01-20 12:17:37 -08:00
Yehuda Katz
55647286da
Make it possible to supply default serializer
...
options in a controller.
2012-01-11 21:30:10 -07:00
Yehuda Katz
671fc14888
remove scope as a separate concept and pass it in
...
as an option.
2012-01-11 21:16:02 -07:00
Yehuda Katz
c083774f9c
Check for respond_to? :to_ary instead of being
...
an Array.
2012-01-10 20:53:29 -07:00
Yehuda Katz
87d2d77ac8
In a controller, the current controller name should be the default root for collections
2012-01-01 16:01:59 -08:00
Yehuda Katz
df9ad0ef11
Improve serializers:
...
* Many nested levels of associations can now insert
their information alongside the original when
embed :ids, :include => true is true
* Add support for passing options to serializers
* Fix Array serializers so they don't try to insert
roots for each child object and so they can be
provided a root.
* TODO: Array serializers should require a root
* TODO: Make merging associations at the root more
efficient if possible
2011-12-20 00:03:29 -08:00
Yehuda Katz
ac23a9e10e
The serialization_scope should default to current_user
2011-12-16 14:49:40 -08:00
Adman65
fffce85c5d
Remove Rails dependency
...
Move configuration into a Railtie.
Only dependency is now activemodel
2011-12-01 19:10:56 +02:00