Commit Graph

245 Commits

Author SHA1 Message Date
Santiago Pastorino
ee846f39af Fix build in 1.8.7 2013-05-22 14:24:22 -07:00
Damian Galarza
bbc3ae44cc Allow a controller to properly override scope_name 2013-05-21 21:24:50 -04: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
2b22acff53 Use the readers instead of accessing the ivar directly 2013-05-21 17:03:07 -07:00
Santiago Pastorino
251fdc7ba4 Rename opts to klass_options 2013-05-21 17:03:07 -07:00
Santiago Pastorino
0b9f69529f Add default_embed_options 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
a41de0286f Passing options[:hash] is not public API of include! 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
Santiago Pastorino
f179a27ed7 Add docs to serializable 2013-05-21 17:03:06 -07:00
Santiago Pastorino
aaa08c25ef Make include_meta and meta_key private 2013-05-21 17:03:06 -07:00
Santiago Pastorino
76fead041f Make Serializer reuse Serializable 2013-05-21 17:03:06 -07:00
Santiago Pastorino
0e876624ec Move reusable code to a module 2013-05-21 17:03:05 -07:00
Santiago Pastorino
64ed05c484 Define serializer as DefaultSerializer if not set 2013-05-21 17:03:05 -07:00
Steve Klabnik
fe84e0ad52 version bump 0.8.1 2013-05-05 17:35:51 -07:00
Sam
597a2e3148 allow serializers to implement an options attribute 2013-05-06 10:30:46 +10:00
Steve Klabnik
a022d464f5 Bump to 0.8.0 2013-05-05 13:45:50 -07:00
Steve Klabnik
bb8900e308 Merge pull request #264 from vad4msiu/features/root_element
Support for setting root element
2013-05-05 12:02:27 -07:00
Steve Klabnik
cffdbce072 Merge pull request #283 from morgoth/add-only-and-except-options-support
Add only and except options support
2013-05-05 12:00:59 -07:00
Steve Klabnik
da779c259f Merge pull request #293 from goshakkk/mongoid-support
add support of mongoid collection serialization
2013-05-05 12:00:04 -07:00
Gosha Arinich
1482081766 add support of mongoid collection serialization 2013-05-05 21:50:34 +03: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
Gosha Arinich
7f75b15ddd include serializer support into mongoid 2013-05-04 22:43:11 +03:00
Wojciech Wnętrzak
489ebf2132 Added support for :only and :except methods.
It is possible now to filter returned attributes and associations by:

  UserSerializer.new(user, only: [:first_name, :last_name])
  UserSerializer.new(user, except: :first_name)
2013-04-27 21:29:26 +02:00