Commit Graph

912 Commits

Author SHA1 Message Date
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
a8760fa854 Add pry 2012-01-10 15:16:00 -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
e7d66ee423 we use textile, not markdown, duh 2011-12-20 00:14:27 -08:00
Yehuda Katz
cbb6389f59 Add status button 2011-12-20 00:06:50 -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
8bdb7da272 Fix compatibility mistakes with ActiveRecord 2011-12-19 23:07:55 -08:00
Yehuda Katz
15abccdbeb Merge pull request #16 from joshk/master
MOAR RUBIES
2011-12-16 15:13:42 -08:00
Josh Kalderimis
d0cc1e3065 lets test against MOAR RUBIES 2011-12-17 00:03:23 +01:00
Yehuda Katz
ac23a9e10e The serialization_scope should default to current_user 2011-12-16 14:49:40 -08:00
José Valim
8d20058bf3 Merge pull request #15 from sbounmy/master
documentation update
2011-12-16 12:18:05 -08:00
Bounmy Stephane
1a8526239f fixed doc : ActiveModel::Serializer takes care of object initialization 2011-12-16 11:51:57 -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
José Valim
03f08a8351 Merge pull request #11 from Adman65/has_many-implicit-serializer
Has many implicit serializer
2011-12-12 02:49:34 -08: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
José Valim
97113ae2bf Merge pull request #9 from Adman65/patch-1
Update readme to reflect yehuda's change from :as to :key
2011-12-09 07:09:07 -08:00
Adman65
a0388a316f Update readme to reflect yehuda's change from :as to :key 2011-12-09 15:43:40 +01:00
Yehuda Katz
09ddc79ce0 Better tests for embeds 2011-12-07 15:12:56 -08: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
José Valim
3b38af1b49 Merge pull request #8 from Adman65/association_options
Closes #4 (Associations with :as)
2011-12-06 06:19:52 -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
Yehuda Katz
054eeda12b Invalid gemspecs are bad 2011-12-05 17:37:14 -08:00
Adman65
2719502286 Remove puts 2011-12-02 18:17:38 +02:00