Commit Graph

64 Commits

Author SHA1 Message Date
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
af34adc7b5 Move key's initialization code to initializers 2013-10-18 17:49:19 -02:00
Santiago Pastorino
280fd65db8 Allow to set key for associations through options 2013-10-18 17:49:19 -02:00
Santiago Pastorino
48590a2e37 Allow to set root for associations through options 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
e6993c677b Add missing requires 2013-10-18 17:49:18 -02:00
Santiago Pastorino
70ea6c6bc7 Add has_one and has_many :serialize => tests 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
0d4dfb69a9 Fix directories the project is on top level dir 2013-10-18 17:49:17 -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
35608a8550 Move version.rb file to serializer directory 2013-05-21 17:03:09 -07: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
787b7cf24a Document Associations 2013-05-21 17:03:08 -07:00
Santiago Pastorino
0b6326eb35 Move polymorphic to initialize + reader 2013-05-21 17:03:08 -07:00
Santiago Pastorino
36feb5d44f Refactor embeddable? method 2013-05-21 17:03:08 -07:00
Santiago Pastorino
bbd3c8b157 Define embeddable? as an alias of object 2013-05-21 17:03:08 -07:00
Santiago Pastorino
e295af2e2b Move embed methods to initialize and define readers 2013-05-21 17:03:08 -07:00
Santiago Pastorino
cd9e106640 All the attr_readers together 2013-05-21 17:03:08 -07:00
Santiago Pastorino
1c3f14407c There's no need for target_serializer method 2013-05-21 17:03:08 -07:00
Santiago Pastorino
feaefeeef3 Use name reader 2013-05-21 17:03:08 -07:00
Santiago Pastorino
296970415a Move key method to the base class 2013-05-21 17:03:08 -07:00
Santiago Pastorino
ecbb8bf6a6 Use == || == instead of include? 2013-05-21 17:03:08 -07:00
Santiago Pastorino
eb5b27de69 Initialize things in the initialize method and define readers 2013-05-21 17:03:08 -07:00
Santiago Pastorino
ea6d712cc8 key method is defined on subclasses 2013-05-21 17:03:07 -07:00
Santiago Pastorino
2dd0090f13 Reorder methods 2013-05-21 17:03:07 -07:00
Santiago Pastorino
0b648fceac Use private instead of protected, we don't use explicit receivers 2013-05-21 17:03:07 -07:00
Santiago Pastorino
f9e189e9d7 Rename associated_object to object 2013-05-21 17:03:07 -07:00
Santiago Pastorino
85bf3d2f3d Move duplicated code to the Base class 2013-05-21 17:03:07 -07:00
Santiago Pastorino
03669a74bc Associations::Config is now Associations::Base 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
c1e710aae1 Save result of calling associated_object in a local var 2013-05-21 17:03:06 -07:00
Santiago Pastorino
baa690a01a Move if object to the top 2013-05-21 17:03:06 -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
9f5e872621 Extract id_key to a method 2013-05-21 17:03:06 -07:00
Santiago Pastorino
ea3566955c Remove option method just use the reader 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
Gosha Arinich
e8ae3e1bb3 allow singular embed when serializing association
Having

```ruby
has_one :post, embed: :ids
```

looks especially weird as it's a one-to-one association, hence there is
only one id. The following looks better:

```ruby
has_one :post, embed: :id
```
2013-05-05 11:02:42 +03:00
Sean Abrahams
79acd87829 Use method instead of asssociation_ids if method exists. Fixes #267 2013-04-10 14:38:53 -07:00
Steve Klabnik
9551a97464 Revert 37b0690fb8.
This feature causes more problems than it solves.
2013-04-03 17:24:08 -07: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
fd578fcf69 Refactor and consolidate serializer option setup 2013-03-19 22:21:41 -04:00