Commit Graph

36 Commits

Author SHA1 Message Date
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
José Valim
d72b66d4c5 Ported serializers. 2011-12-01 07:38:51 +01:00