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
Prathamesh Sonpatki
7d1ce9c56e
Fixed typos
2013-03-26 18:18:20 +05:30
Kevin Mahoney
2bd447d69d
Pass options through when using default serializer
2013-03-22 13:12:33 +00:00
Steve Klabnik
680e2efbec
Merge pull request #246 from beerlington/dry-option-setup
...
Refactor and consolidate serializer option setup
2013-03-20 08:56:54 -07: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
Steve Klabnik
c129ae2016
Generate id method on Ruby 1.8.
...
Because object_id and id went through some flux, it's best to tell 1.8
specifically what we mean.
Closes #127 .
2013-03-19 14:53:08 -07:00
Steve Klabnik
145b6d499d
First part of a fix for #208 .
...
I would like to get this under test.
2013-03-19 13:52:20 -07:00
Sam
af13d48dfa
improved caching of root node for better performance
2013-03-18 16:21:34 -07: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
Steve Klabnik
746a63ab09
Merge pull request #89 from twinturbo/caching
...
Serializers Cache JSON & Hashes
2013-03-15 10:30:04 -07:00
Tony Pitale
d3c6596990
make sure to merge the original responder options into the given options to preserve location
2013-03-15 03:54:35 -04:00
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
Jo Liss
6281a9149e
Make schema not crash on computed attributes
...
We do not know the type for computed attributes, so we pick nil.
Perhaps at some point we might add a :type option for attributes (or
not), but in any case it's important to not crash when there are
computed attributes.
2012-10-31 20:07:08 +01:00
Jo Liss
c767d7f5e4
Remove newly-redundant OrderedSet
2012-10-29 23:15:39 +01:00
Jo Liss
ee3cec3d0c
When objects are sideloaded multiple times, serialize them only once
...
To achieve this, we make the following change when sideloading: Instead
of serializing associations and discarding duplicate *hashes*, we
memorize the *objects* (records) that we have already serialized, and
only serialize those that are new.
This change is mostly transparent, and brings down serialization time
from 3.1 seconds to 1.0 seconds on my set of sample data.
There is one change in the behavior: If you sideload the same object
multiple times, and it yields different hashes, like so:
embed :ids, include: true
has_many :comments
has_many :recent_comments, root: comments, serializer: CommentShortSerializer
then previously, it would be included multiple times, whereas now, the
first hash wins. (I haven't actually tested this.) I don't know that
either option is preferable. It's not covered by the test suite, and I
think it's an edge case that is OK to ignore entirely.
2012-10-29 23:15:32 +01:00
Jo Liss
6be6ed8326
Extract Associations module into separate file
2012-10-29 17:21:27 +01:00
José Valim
be70c5c846
Revert "clean up lazy loading of serialization support for
...
ActiveRecord::Base and ActionController::Base"
The whole idea of having a lazy hook is that it can be executed
in the context of different targets. The moment you hardcode the class,
the hooks can no longer run in the proper context.
This reverts commit 506e2ac9ad .
2012-10-17 19:28:02 +02:00
Dan Gebhardt
506e2ac9ad
clean up lazy loading of serialization support for ActiveRecord::Base and ActionController::Base
2012-09-20 14:23:59 -04:00
Tee Parham
9584b9e147
move OrderedSet to separate file
2012-09-18 01:28:07 +02:00
Tee Parham
b8f01ba2f3
move ArraySerializer to separate file
2012-09-18 01:28:07 +02:00
Yehuda Katz
2130cdfc00
List out the event names to avoid garbage
2012-09-16 20:20:34 -07:00
Yehuda Katz
a025f1b6f6
Eliminate some String garbage
2012-09-16 20:08:30 -07:00
Yehuda Katz
9da0176d2b
Merge branch 'master' of github.com:josevalim/active_model_serializers
2012-09-16 19:46:17 -07:00
Yehuda Katz
84f8c1c3d5
Merge branch 'master' of github.com:josevalim/active_model_serializers
2012-09-02 21:21:05 -07:00
Dan Gebhardt
42221a6140
define include_XXX? methods, which can be overridden to conditionally include attributes and associations
2012-08-29 09:26:41 -04:00
Dan Gebhardt
68dc57eb73
simplified the API for include_associations!() to make conditional includes cleaner
2012-08-29 07:42:23 -04:00
twinturbo
38859d1f3d
Easier to work with polymorphic interface
2012-08-25 17:39:39 +02:00
Alex Kwiatkowski & Will Bagby
754aa295ba
Return empty hash when url_options not provided
2012-08-07 12:56:58 -04:00
Ray Cohen
424dacb457
scope option to render takes precedence over serialization_scope
2012-07-28 21:06:15 -04:00
Jo Liss
e8f2ecebfb
Use blocks instead of eval to define methods
2012-07-26 00:28:59 +02:00
Tee Parham
663d443884
Merge branch 'array-serializer-root' of github.com:teeparham/active_model_serializers into readme-arrays
2012-07-23 13:02:04 -06:00
Tee Parham
53da0b12fd
add docs for serializing arrays
2012-07-21 15:25:41 -07:00
José Valim
ef7d475912
Merge pull request #94 from teeparham/array-serializer-root
...
Add root option to ArraySerializer
2012-07-21 00:38:18 -07:00
José Valim
62484e758c
Merge pull request #95 from twinturbo/set-serializer
...
Close #90
2012-07-21 00:37:31 -07:00
José Valim
6f07a0297e
Merge pull request #97 from twinturbo/include-bug
...
Include Related Bugs
2012-07-21 00:36:04 -07:00
Chris Schmitz
a6473e70c4
Fix a couple typos.
2012-07-16 09:29:12 -05:00
twinturbo
6f3b250dc9
Don't include empty polymoprhic associations
...
Take this serializer:
class TodoSerializer < ActiveModel::Serializer
root :todo, :include => true
has_one :reference, :polymorphic => true
end
A nil reference would generate this JSON:
{
"todo": { "reference": null },
"nil_classes": []
}
This commit prevents the `nil_classes` key from being added when
serializing and including nil polymoprhic associations.
2012-07-16 15:08:01 +02:00
twinturbo
486d282922
Raise error when associations cannot be included
...
include! only works when the source serializer has a root set. The
as_json method sets up some state for the include! method. If a child
association has associations with `:include => true` or `root foo,
:include => true` would cause an undefined method error for `NilClass`.
This is entirely unhelpful for the end user.
This commit raise an error when this situation occurs. It makes it clear
that it's not a problem with AMS but the serialization graph.
2012-07-16 14:18:58 +02:00
twinturbo
7072e79787
Close #90
2012-07-15 12:18:41 +02:00
twinturbo
f01fe14972
Fix spelling mistakes
2012-07-15 11:49:36 +02:00
twinturbo
9f20fe8b36
Test passes
2012-07-15 11:49:36 +02:00
twinturbo
7e96856b87
Support serialize polymorphic id
2012-07-15 11:49:36 +02:00
twinturbo
32f8779114
Basic rooted polymorphism
2012-07-15 11:49:36 +02: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
twinturbo
7936e3efba
Add "scope" method
2012-07-14 14:54:23 +02:00
José Valim
3e87c6414d
Merge pull request #92 from twinturbo/query-attributes
...
Close #86
2012-07-14 04:16:07 -07:00
twinturbo
2b9cd97436
Close #86
2012-07-14 13:12:26 +02:00
José Valim
d6a68ed14f
Merge pull request #85 from pushcx/master
...
Allow setting :each_serializer in 'render :json' calls
2012-07-14 04:05:40 -07:00
Bradley Priest
f41978b8de
move array_serializer logic to active_model_serializer.rb
2012-07-10 10:23:45 +08:00
Bradley Priest
7eb2b90b7c
Automatically include ArraySerializer in ActiveRecord::Relation
...
fixes #81
2012-07-10 10:17:54 +08:00
Peter Harkins
1c820a9ba7
Allow setting the serializer for ArraySerializer.
2012-06-21 11:12:13 -05:00
Yehuda Katz
1e777ced0e
Merge branch 'master' of github.com:josevalim/active_model_serializers
2012-06-20 00:56:31 -04:00
Tee Parham
c898e3daf9
remove unncessary is_a?(Hash) check
2012-06-12 10:38:32 -07:00
Yehuda Katz
615afd125c
Allow other resource overrides
2012-06-05 23:08:01 +02:00
Andy Lindeman
47850677e9
Allows serialization_scope to be disabled with serialization_scope nil
2012-06-05 12:37:09 -04:00
Yehuda Katz
00194ec0e4
Bump version
2012-06-05 10:18:59 +02:00
Yehuda Katz
681bcf5ad7
Always add :id to attributes
2012-06-05 10:05:06 +02:00
twinturbo
2139a6d07a
Add AS::Notifications (thx @twinturbo)
2012-06-05 10:01:53 +02:00
Yehuda Katz
6e2554d741
Merge pull request #62 from highgroove/cleanup_scope_instance_variables
...
Remove left over references to scope instance variable
2012-06-05 00:32:23 -07:00
Yehuda Katz
3cb74887df
Merge pull request #65 from teeparham/array-root
...
use :root option in render :json
2012-06-05 00:31:13 -07:00
Yehuda Katz
8376a4dcd1
Merge pull request #69 from teeparham/array-serializer
...
Array serializer should support Hash, AMS, and PORO
2012-06-05 00:23:17 -07:00
Andy Lindeman
9a3bd4770a
rails generate runs correctly under Rails 3.0.x
...
* Rails 3.0.x does not yield `app` to `generator` blocks in railties.
Picks a hopefully reasonable default `Rails.application` in that case.
* Fixes #71
2012-06-01 10:08:58 -04:00
Tee Parham
f35a2261d2
support different serializations in ArraySerializer
...
ArraySerializer can serialize arrays of Hash, ActiveModel::Serializer,
or any PORO that responds to :as_json
Each item in the array should not include its type as a root element,
since normal arrays do not do this. If you want "typed" collections,
don't use an Array.
2012-05-30 14:52:52 -06: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
José Valim
5beecd5947
Fix the build on 1.8.7 :trollface:
2012-05-17 19:28:15 +02:00
José Valim
7a093afd03
Revert "Fix build for real"
...
This reverts commit 43f32c868a .
2012-05-17 19:16:11 +02:00
vanstee
81fddb55d3
Remove left over references to scope instance variable
2012-05-16 22:54:26 -04: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
43f32c868a
Fix build for real
2012-05-16 18:28:24 -07:00
Yehuda Katz
c6b1cea4bc
Fix the build
2012-05-16 18:26:57 -07:00
Yehuda Katz
5f4f6a3483
Merged on_load
2012-05-16 18:17:21 -07:00
Yehuda Katz
0f1ec7a3cf
Add support for customizing fields
2012-05-16 18:13:59 -07:00
James A. Rosen
4c17a22207
add ActiveSupport.on_load announcement
2012-05-16 15:31:32 -07:00
tomhuda
33d4842dcd
Prep for 0.5.0
2012-05-16 14:17:10 -07:00
Yehuda Katz
a2d73faa63
Generate a serializer with each new model
2012-04-30 17:18:51 -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
ctide
f17e4cde39
Add a :root option to associations, which enables you to define what the root level key will be for the associated objects.
2012-02-22 19:35:10 -08:00
Justin Brown
19c0b35473
Fix comment.
2012-02-14 15:39:46 -05:00
Carl Lerche
46f18343cd
Add an options attr_reader in the ArraySerializer
2012-01-20 12:17:51 -08:00
Carl Lerche
4e8a2af1ec
Allow passing in the serializer class from the render method
2012-01-20 12:17:37 -08:00
tomhuda
dd32f91a25
Optimize merging associations
2012-01-16 12:12:00 -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
4ad9c64e46
Allow serializers to receive instructions to
...
explicitly include or exclude specific lists of
associations.
2012-01-11 20:56:36 -07:00
Yehuda Katz
fb6af2efbb
Making include_associations! a public API
2012-01-11 20:03:48 -07:00
Yehuda Katz
573be9302d
Encapsulate more concerns in the associations.
2012-01-11 20:01:47 -07:00
Yehuda Katz
fb45aa4838
Simplify association call signature
2012-01-11 16:09:38 -07:00
Yehuda Katz
c32558248a
Cleanup
2012-01-11 16:02:23 -07:00
Yehuda Katz
d42634a1d2
Remove dead code.
2012-01-11 15:54:41 -07:00
Yehuda Katz
020b2a19df
serializable_hash should just call include!
2012-01-11 15:48:16 -07:00
Yehuda Katz
5a8682b4e6
Make it easier to look up associations by name.
2012-01-11 15:36:17 -07:00
Yehuda Katz
b22eebf569
More refactoring:
...
* Changed associations to be classes
* remove @hash and always use @options[:hash]
* pass serializer options down to child serializers
2012-01-11 15:28:49 -07:00
Yehuda Katz
72b8213bee
If an existing association exists, use it to
...
get the value if none was provided.
2012-01-11 13:06:19 -07:00
Yehuda Katz
dd0b56c748
HasOne associations work
2012-01-11 12:26:49 -07:00
Yehuda Katz
f9d0259340
Start cleaning up serializers to support
...
include/exclude functionality.
This process involves building a few lower-level
primitives so not as much logic is hardcoded in
monolithic helper methods.
2012-01-11 12:18:18 -07:00
Yehuda Katz
ab1a4074ba
Revert polymorphism
2012-01-11 11:13:32 -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
4965558d27
with ember :ids, :include => true, has_one
...
associations should include plural versions at
the root, not singular ones.
2012-01-10 15:16:00 -07:00
José Valim
1470e3a3f4
Merge pull request #24 from Adman65/polymorphic-associations
...
Polymorphic associations
2012-01-03 03:40:56 -08:00
adman65
09bb41fbdb
Add test cases for nil polymorphic associations
2012-01-03 13:37:39 +02:00
adman65
54d3f2edf0
Add polymorphic key to utility method
2012-01-03 13:26:47 +02: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
e23553be23
The Array serializer should not make a child root for every item in the Array
2011-12-29 18:13:25 -08:00
adman65
da0c33f53c
Improve polymorphic associations
2011-12-21 20:25:40 +02:00
José Valim
1e0c9ef93b
Release 0.1.0
2011-12-21 09:14:14 +01:00
José Valim
b9d56a5168
Fix constant lookup when serializer is not available.
2011-12-21 09:11:04 +01:00
José Valim
cc5f102e2d
Remove implicit constant lookup in serializers in favor active_model_serializer API.
2011-12-21 08:48:29 +01:00
José Valim
97ff4d28e6
Allow as_json(true) to be given.
2011-12-21 08:17:22 +01:00
adman65
c8c8246e24
Pull in upstream
2011-12-21 00:00:09 +02: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
8bdb7da272
Fix compatibility mistakes with ActiveRecord
2011-12-19 23:07:55 -08:00
Yehuda Katz
ac23a9e10e
The serialization_scope should default to current_user
2011-12-16 14:49:40 -08:00
Adman65
75516ecb48
Demodulize
2011-12-12 14:57:12 +01:00
Adman65
1e32090477
Serialize polymorphic id like a composite FK
2011-12-12 14:41:34 +01:00
Adman65
638614ffde
Move polymorphic type into the serializable_hash
2011-12-12 14:33:18 +01:00
Adman65
9fa716e452
Fixes #12
2011-12-12 13:13:38 +01:00
Adman65
5e5c0213a7
Refactor serializer class detection
2011-12-12 10:30:20 +01:00
Adman65
2460832236
Use singular serializer name for default
2011-12-12 10:02:46 +01:00
Adman65
2c240cf2e0
Implicit detection for has_many serializer
2011-12-09 16:16:09 +01:00
Yehuda Katz
57ef67dcb4
Allow attribute aliasing
2011-12-07 14:35:07 -08:00
Yehuda Katz
7dd3bdaca9
We can't just piggyback on serialization because it may already be included at this point.
2011-12-07 12:25:11 -08:00
Yehuda Katz
ca7786c2e0
Rename :as to :key, as it's confusing
2011-12-07 12:16:22 -08:00
Yehuda Katz
5054d2a449
Whitespace fixes
2011-12-07 11:56:31 -08:00
Yehuda Katz
0f4b61fbcf
Provide a schema for a serializer
2011-12-07 11:56:27 -08:00
Yehuda Katz
4efb1f33ab
alias send to read_attribute_for_serialization on AMo
2011-12-06 19:08:38 -08:00
Adman65
498c780a8f
Closes #4
2011-12-06 15:52:28 +02:00
José Valim
3edf6c2b39
Merge pull request #2 from Adman65/master
...
Remove Rails Dependency
2011-12-06 00:49:09 -08:00
José Valim
c0433d2862
Remove test framework hook, closes #6
2011-12-06 09:46:07 +01:00
Adman65
2719502286
Remove puts
2011-12-02 18:17:38 +02:00
Adman65
73ecb94d24
Remove railtie
2011-12-02 00:27:20 +02: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
5a230e8e66
Added tests.
2011-12-01 08:19:14 +01:00
José Valim
d72b66d4c5
Ported serializers.
2011-12-01 07:38:51 +01:00