twinturbo
c3966fe741
ArraySerializer is also cached
2013-03-14 22:54:05 +01:00
twinturbo
bd90af0e49
Remove commented code
2013-03-14 22:41:34 +01:00
twinturbo
b854d49298
Rebase against master
2013-03-14 22:40:46 +01:00
twinturbo
5027f04441
Update railtie
2013-03-14 22:40:07 +01:00
twinturbo
e3888f0a40
Clean up interface inconistency
2013-03-14 22:40:06 +01:00
twinturbo
535a33a33b
Have to opt in with #cache_key
2013-03-14 22:40:06 +01:00
twinturbo
e923174a26
#cache_key delegates to #object by default
2013-03-14 22:40:06 +01:00
twinturbo
b4395f281b
Add basic caching
2013-03-14 22:40:06 +01:00
Steve Klabnik
6408b73e3c
Merge pull request #233 from SamSaffron/fix
...
Optimised performance for attribute extraction
2013-03-14 14:22:27 -07:00
Sam
710c375088
remove safe guard per discussion with steveklabnik
2013-03-14 14:11:04 -07:00
Michael Rykov
b3a6fa6334
Ensure that ActionController includes MimeResponds
2013-03-14 11:15:14 -07:00
Sam
08a182d743
per discussion remove instrumentation altogether
2013-03-13 22:18:40 -07:00
Sam
31ba6fbb08
Optimised performance for attribute extraction
...
Disabled all instrumentation unless enabled explicitly
2013-03-13 21:20:56 -07:00
Michael Rykov
37b0690fb8
Add a Responder to handle respond_with(resource)
2013-03-13 16:45:23 -07:00
Steve Klabnik
f4916f113f
Merge pull request #223 from tchak/id-serialization-with-hooks
...
use `read_attribute_for_serialization` to serialize ids
2013-03-08 09:17:19 -08:00
Steve Klabnik
e76a16486f
Merge pull request #170 from FundingGates/master
...
Support optional types for computed attributes
2013-03-08 09:11:29 -08:00
tchak
e2c10f4440
use read_attribute_for_serialization to serialize ids
...
* in order to allow some optimisation in simple cases, we call `read_attribute_for_serialization` on parent with association_id name
2013-03-08 09:57:42 +01:00
Steve Klabnik
a1755c5b27
Provide a mixin to override AR::Base#to_json
...
Fixes #192 .
2013-03-06 15:32:09 -08:00
Adam Stanton
5a55a6831a
Remove line break on the conditional statement.
2013-03-06 11:48:50 -08:00
Adam Stanton
da26ebd26f
Merge branch 'create-default-serializer' into HEAD
...
Conflicts:
lib/active_model/array_serializer.rb
2013-03-05 21:48:58 -08:00
Steve Klabnik
fabdc621ff
bumping to 0.7.0
2013-03-05 17:07:16 -08:00
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
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
Ismael Abreu
2d2094b588
changes to be able to specify multiple attributes with keys
2013-03-05 02:45:22 +00: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
Tony Pitale
dcd4121322
reduce 2x map; fixes datamapper eager loading
2013-02-17 16:44:27 -05: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
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
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
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
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
Matt Rogish
25c564bd6f
Adding optional type for attributes
2012-12-10 19:58:58 -05:00
Steve Klabnik
6780cd3df5
Merge pull request #138 from tchak/meta
...
Meta object
2012-12-10 10:48:39 -08: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
Kevin Tham
14a35ab2f8
Remove unneeded method aliasing of attribute reader: object, with the underscored class name of serializer, to fix issue where a model's attribute name matches that of the underscored prefix of the serializer
2012-11-25 00:17:17 -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
Jo Liss
2fc083a1fe
Merge pull request #117 from joliss/computed-attributes
...
Make schema not crash on computed attributes & associations
2012-11-22 08:31:18 -08:00
tchak
a71698d5bb
Add support for meta key
...
Test for meta_key serialization
2012-11-22 13:44:59 +01:00
Samnang Chhun
96ce310595
Add alias_method ActiveModel::Serializer.root= to be consistency with ActiveModel::ArraySerializer
2012-11-20 00:29:00 +07:00
Jo Liss
538b0c0916
Make schema not crash on computed associations
...
We pick nil here as well.
2012-10-31 20:07:08 +01:00