Commit Graph

226 Commits

Author SHA1 Message Date
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
Wojciech Wnętrzak
82f50ef81f Unify way of calling include_attribute? in attibutes and association methods. 2013-04-20 23:28:33 +02:00
Jason Kriss
4e762ee8b5 fix a couple typos 2013-04-18 13:39:14 -07:00
Steve Klabnik
c1dacccbdc Merge pull request #273 from seanabrahams/embed-ids-not-using-local-method
Fixes #267
2013-04-15 17:44:06 -07:00
Steve Klabnik
3433eca4d3 Merge pull request #268 from vanstee/escape-attribute-names
Support "unsymbolizable" strings as attribute names
2013-04-15 17:25:24 -07:00
Jakub Arnold
1c1a4f7673 Fix serialization_scope to check for private/protected methods
The semantics of respond_to? on Ruby 2.0 have changed to return false for protected methods, which is usually the case for helpers like current_user.
2013-04-13 09:59:10 +03:00
Sean Abrahams
79acd87829 Use method instead of asssociation_ids if method exists. Fixes #267 2013-04-10 14:38:53 -07:00
vanstee
a900d31041 Support strings as attribute names
When generating the `_fast_attributes` method, attribute names that
could not be represented as symbols (at least without escaping) would
throw parsing errors.
2013-04-09 00:53:56 -04:00
vad4msiu
95081410d2 Support for setting root element 2013-04-04 15:10:29 +04:00
Steve Klabnik
2edaa22605 Require _our_ resource_override.
Basically, when anyone else made a 'resource_override' generator,
it'd only require once. Because that's how require works. So let's make
sure that we require ours and nobody else's.

Fixes #251.
2013-04-03 23:24:19 -07:00
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