Commit Graph

470 Commits

Author SHA1 Message Date
Steve Klabnik
dc2257977f Merge pull request #198 from jredburn/master
'embed_key' option to allow embedding by attributes other than IDs
2013-03-05 15:57:34 -08:00
Steve Klabnik
06c65871a8 Merge pull request #213 from michihuber/fix_rendering_nil_with_custom_serializer
Fix rendering nil with custom serializer
2013-03-05 15:54:51 -08:00
Jeremy Redburn
7cd7d295e0 Adding 'embed_key' option to allow embedding attributes other than ID 2013-03-05 18:52:31 -05:00
Steve Klabnik
d638e21c8c Merge pull request #180 from fellix/fix-remove-root-globally
Fix global ``` self.root = false ```
2013-03-05 15:48:08 -08:00
Steve Klabnik
585b1bc508 No longer recommend installation from git 2013-03-05 15:28:56 -08:00
Steve Klabnik
95937c6fc7 Merge pull request #167 from GateGuru/feature/specify-association-serializers-as-strings
Add support for specifying the serializer for an association as a String...
2013-03-05 15:04:29 -08:00
Steve Klabnik
49cca10592 Merge pull request #172 from vladson/patch-1
Added description of default_serializer_options to README.md. Fixes #168
2013-03-05 14:46:06 -08:00
Steve Klabnik
71bf522b38 Merge pull request #209 from ismaelga/attributes_with_keys
Able to specify keys on the attributes method
2013-03-05 14:29:28 -08:00
Steve Klabnik
9a54af30e2 Merge pull request #218 from phcoliveira/patch-1
Update README.md file to better describe scope.
2013-03-05 14:22:29 -08:00
Paulo H. C. de Oliveira
e322f903cf Update README.md file to better describe scope.
This commit also corrects the code about deactivating globally the root name of arrays.
2013-03-05 13:37:11 -03:00
Ismael Abreu
2d2094b588 changes to be able to specify multiple attributes with keys 2013-03-05 02:45:22 +00:00
Steve Klabnik
1c28577280 Merge pull request #215 from mulder/feature/reloading
Serializer Reloading via ActiveSupport::DescendantsTracker
2013-02-28 09:03:02 -08:00
Nicholas Mulder
918a9de546 Remove caching of Serializer constants to allow ActiveSupport::Dependency reloading to work 2013-02-28 10:02:38 -05:00
Nicholas Mulder
fa51c5f574 Add ActiveSupport::DescendantsTracker to Serializer and ArraySerializer 2013-02-28 10:01:40 -05:00
Michi Huber
c7a420d295 Don't fail if object is nil, render null 2013-02-26 11:17:28 +01:00
Michi Huber
58a063eff0 serialization test: respect root settings when root object is nil 2013-02-26 11:12:28 +01:00
Michi Huber
9f93f34a34 test cases by fblee
Merge remote-tracking branch 'fblee/master'
2013-02-26 09:57:35 +01:00
Steve Klabnik
0114e49238 Merge pull request #210 from tpitale/master
Reduce double map to once; Fixes datamapper eager loading.
2013-02-18 09:04:37 -08:00
Tony Pitale
dcd4121322 reduce 2x map; fixes datamapper eager loading 2013-02-17 16:44:27 -05:00
Adam Stanton
b4616d737c Restore order of fields in hash to original order. 2013-02-11 07:04:59 -08:00
Adam Stanton
e470b09c6e Remove pry-nav from gemspec. 2013-02-11 06:03:48 -08:00
Adam Stanton
c4fcf96eb4 Move DefaultSerializer from array_serializer.rb to serializer.rb 2013-02-10 09:49:11 -08:00
Adam Stanton
8f6218c587 Create DefaultSerializer so that as_json uses same interface.
This is to ensure that PORO's as_json is called if no serializer
is specified.

Original behaviour was that serializable_hash was being called,
overriding the as_json method.
2013-02-10 09:06:24 -08:00
Carlos Antonio da Silva
3e9b366a45 Merge pull request #206 from kirs/patch-1
Gemfile improvement in README [ci skip]
2013-02-09 13:41:41 -08:00
Kir Shatrov
dd989043e3 Gemfile improvement in README 2013-02-09 23:04:25 +02:00
Lee Mallabone
d35999a7ee Add failing test to show behavior of custom serializer with nils. 2013-02-06 17:32:15 -08:00
Rafael Felix
82951c1f8a Fix global `` self.root = false ``
Using the on_load hook does not change the defined root on
Serializer#inherited.

Related to #179
2013-01-24 09:13:41 -02:00
Steve Klabnik
cef10cf01d Revert "Merge pull request #186 from gerfuls/master"
This reverts commit d030cd99cf, reversing
changes made to a1d5561eac.
2013-01-15 11:51:42 -05:00
Steve Klabnik
d030cd99cf Merge pull request #186 from gerfuls/master
Fixed typo for turning off global root
2013-01-12 17:26:38 -08:00
Joshua Dover
016412b3d7 Fixed README typo 2013-01-12 19:18:08 -06:00
Steve Klabnik
a1d5561eac Merge pull request #185 from kevins90/update_readme_object_accessor
Revised one more instance in the doc referring to the object method alias
2013-01-11 10:10:05 -08:00
Kevin Tham
3cd953ffa8 Revised one more instance in the doc referring to the method alias to access the object being serialized 2013-01-11 10:01:37 -08:00
Rafael Mendonça França
95ff5d5960 Merge pull request #184 from eniolopes/master
Documentation for meta and meta_key options
2013-01-11 06:06:13 -08:00
Enio Lopes
97e7ec1d32 Uses colon on :meta_key 2013-01-11 11:22:45 -02:00
Enio Lopes
244021d65c Corrects some markdown properties, identation and text 2013-01-11 11:06:26 -02:00
Enio Lopes
0994f3dda8 Adds documentation for usage of meta and meta_key options 2013-01-11 00:18:53 -02:00
Steve Klabnik
e4d244f865 Merge pull request #183 from kevins90/update_readme_associations
Update association section on README.md
2013-01-10 10:51:05 -08:00
Kevin Tham
1b6ccbbe7b Update association section on README.md to reflect deprecation of the prefix of the serializer class being used as the accessor to the object we wish to serialize. (reason was previously that the name of the object being serialized is not necessarily going to be the prefix of the serializer class and worse the prefix could have been an attribute of the object itself) 2013-01-10 10:02:38 -08:00
Vladislav
ccc9c2c696 Update README.md
Spelling and murkup mistakes fixed.
2013-01-06 13:31:35 +04:00
Blake Watters
b0aced9ea2 Add support for specifying the serializer for an association as a String.
This enables the deferral of the resolution of the serializer class to prevent NameError exceptions due to reference cycles between serializer classes.
2013-01-05 23:49:28 -05:00
Steve Klabnik
e3bfd07ac4 Merge pull request #161 from kevins90/fix_attr_name_as_serializer_underscored_prefix
Fix serialization of attribute whose name matches the serializer prefix underscored
2013-01-05 14:09:15 -08:00
Steve Klabnik
7f87c9b3f2 Merge pull request #169 from dgeb/embed-with-id-suffix
Update foreign key naming conventions - fixes #158
2012-12-21 22:49:06 -08:00
Steve Klabnik
b5b392395a Merge pull request #177 from hmsimple/fix-id-methods
use _ids method instead of pluck to embed ids
2012-12-21 14:46:17 -08:00
Nick Ragaz
be005c6964 use _ids method instead of pluck 2012-12-21 17:35:16 -05:00
Dan Gebhardt
3b1d2faf51 Append an _id or _ids suffix to associations' keys. Embed objects in root according to their serializers' names.
An `_id` suffix will be appended to the name of HasOne associations, while `_ids` will be appended to the singularized name of HasMany associations. Association keys can still be overridden with the `key` option.

Furthermore, objects embedded in the root are now by default named according to their serializer, instead of the key used for their associations.
2012-12-21 15:14:50 -05:00
Carlos Antonio da Silva
a74fc6c8db Merge pull request #175 from jlecour/deducted_serializer_test
Test : use a deducted serializer on non-ActiveRecord models
2012-12-21 04:11:24 -08:00
Steve Klabnik
89660d1c5d Merge pull request #176 from hmsimple/id-methods
Use pluck(:id) or _id methods instead of associated objects
2012-12-20 11:55:57 -08:00
Steve Klabnik
09dbace891 Merge pull request #173 from jacortinas/document_ams_support_include
Document adding serializer support to normal Ruby classes and other ORM's.
2012-12-20 11:40:51 -08:00
Nick Ragaz
1eb3c27a50 remove debugging code 2012-12-20 13:29:37 -05:00
Nick Ragaz
a854c1b9dc use id methods 2012-12-20 13:21:37 -05:00