Commit Graph

161 Commits

Author SHA1 Message Date
Santiago Pastorino
10e882a14f Allow to set embed options from AM::Serializer 2013-10-18 17:49:20 -02:00
Santiago Pastorino
6f3503c965 Use serializer name as root when root not set 2013-10-18 17:49:19 -02:00
Santiago Pastorino
626a85bc3e Allow using root = false in initialize 2013-10-18 17:49:19 -02:00
Santiago Pastorino
513e7f2166 Add setup method and Setting object to configure AMS 2013-10-18 17:49:19 -02:00
Santiago Pastorino
0e0341effc Implement embed in root 2013-10-18 17:49:19 -02:00
Santiago Pastorino
8a495b1d00 Embedded has_one returns an array with the key pluralized 2013-10-18 17:49:19 -02:00
Santiago Pastorino
3fcd8c5f98 Define root and root= as aliases of _root= 2013-10-18 17:49:18 -02:00
Santiago Pastorino
7ba05c02e3 Make Serializable module which implements as_json 2013-10-18 17:49:18 -02:00
Santiago Pastorino
e6993c677b Add missing requires 2013-10-18 17:49:18 -02:00
Santiago Pastorino
7e83f0c29d Implement ArraySerializer 2013-10-18 17:49:18 -02:00
Santiago Pastorino
61a1669a86 Implement has_many 2013-10-18 17:49:18 -02:00
Santiago Pastorino
516f5bdceb Implement has_one's embed ids include true 2013-10-18 17:49:18 -02:00
Santiago Pastorino
52bb3f6929 Implement has_one's embed objects 2013-10-18 17:49:17 -02:00
Santiago Pastorino
d756ae4a70 Implement has_one's and serialize_ids 2013-10-18 17:49:17 -02:00
Santiago Pastorino
01bc534976 Remove SerializerSupport 2013-10-18 17:49:17 -02:00
Santiago Pastorino
0c91564101 Remove method redefined warning 2013-10-18 17:49:17 -02:00
Santiago Pastorino
9e75625b1f Re-order properties 2013-10-18 17:49:17 -02:00
Santiago Pastorino
93baaa96b1 Implement meta and meta_key for AM::Serializer 2013-10-18 17:49:17 -02:00
Santiago Pastorino
b6f9c5ee43 Implement Serializer's scope 2013-10-18 17:49:16 -02:00
Santiago Pastorino
c3f857d1b6 Implement Serializer's root 2013-10-18 17:49:16 -02:00
Santiago Pastorino
7143eb8301 Serialize just attributes 2013-10-18 17:49:16 -02:00
Santiago Pastorino
14f51f2ea9 Remove everything, rewrite of AMS starts here 2013-10-18 17:46:18 -02:00
Tee Parham
74ba9dc76c upgrade hash syntax 2013-05-30 15:25:06 -06:00
Santiago Pastorino
9521e912fe serialize_ids call methods on the corresponding serializer if defined 2013-05-24 14:09:27 -07:00
Santiago Pastorino
ee846f39af Fix build in 1.8.7 2013-05-22 14:24:22 -07:00
Damian Galarza
bbc3ae44cc Allow a controller to properly override scope_name 2013-05-21 21:24:50 -04:00
Santiago Pastorino
055f8fe33c AMS::Associations::Base is now AMS::Association. HasMany and HasOne inherits from it. 2013-05-21 17:03:08 -07:00
Santiago Pastorino
251fdc7ba4 Rename opts to klass_options 2013-05-21 17:03:07 -07:00
Santiago Pastorino
0b9f69529f Add default_embed_options 2013-05-21 17:03:07 -07:00
Santiago Pastorino
e273a2fb37 Use a third argument to pass serializer_options 2013-05-21 17:03:07 -07:00
Santiago Pastorino
c04d452823 Associations doesn't depend on the source serializer anymore :) 2013-05-21 17:03:07 -07:00
Santiago Pastorino
0917148617 serialize_ids doesn't use source serializer and it's object 2013-05-21 17:03:06 -07:00
Santiago Pastorino
a41de0286f Passing options[:hash] is not public API of include! 2013-05-21 17:03:06 -07:00
Santiago Pastorino
5017fb686a Associations doesn't depend on source serializer anymore 2013-05-21 17:03:06 -07:00
Santiago Pastorino
460a250984 Get rid of refine 2013-05-21 17:03:06 -07:00
Santiago Pastorino
1a8709d71c Move caching to a new module 2013-05-21 17:03:06 -07:00
Santiago Pastorino
76fead041f Make Serializer reuse Serializable 2013-05-21 17:03:06 -07:00
Sam
597a2e3148 allow serializers to implement an options attribute 2013-05-06 10:30:46 +10:00
Steve Klabnik
bb8900e308 Merge pull request #264 from vad4msiu/features/root_element
Support for setting root element
2013-05-05 12:02:27 -07:00
Wojciech Wnętrzak
489ebf2132 Added support for :only and :except methods.
It is possible now to filter returned attributes and associations by:

  UserSerializer.new(user, only: [:first_name, :last_name])
  UserSerializer.new(user, except: :first_name)
2013-04-27 21:29:26 +02:00
Wojciech Wnętrzak
82f50ef81f Unify way of calling include_attribute? in attibutes and association methods. 2013-04-20 23:28:33 +02:00
vanstee
a900d31041 Support strings as attribute names
When generating the `_fast_attributes` method, attribute names that
could not be represented as symbols (at least without escaping) would
throw parsing errors.
2013-04-09 00:53:56 -04:00
vad4msiu
95081410d2 Support for setting root element 2013-04-04 15:10:29 +04:00
Steve Klabnik
9551a97464 Revert 37b0690fb8.
This feature causes more problems than it solves.
2013-04-03 17:24:08 -07:00
Prathamesh Sonpatki
75a72b5cc9 Fixed few typos 2013-03-26 20:29:35 +05:30
Kevin Mahoney
2bd447d69d Pass options through when using default serializer 2013-03-22 13:12:33 +00:00
beerlington
e4ad25073d Adding doc for build_json method 2013-03-20 08:14:23 -04:00
beerlington
fd578fcf69 Refactor and consolidate serializer option setup 2013-03-19 22:21:41 -04:00
beerlington
4a13f86961 Reference scope by same name as serialization scope
By default, the serialization scope uses current_user, and you can
now reference the scope as "current_user" in the serializer. If you
override the scope using "serialization_scope" in your controller,
it will use that method name instead.
2013-03-18 14:44:38 -04:00
Sam
ad1d34b2c4 Fix inheritance issues, poison cache if attributes change 2013-03-16 03:45:06 -07:00