Benjamin Fleischer
2cf5331ad2
Bump to 0.8.4
2017-09-19 08:49:27 -05:00
Dries Harnie
07addbf8c7
AMS 0.8: Fix memory leak with :scope_name ( #1675 )
...
Fix memory leak with :scope_name
Supplying :scope_name causes `ActiveModel::Serializer#initialize` to
define a method on the class, which retains a reference to the
serializer instance.
* Lock version of mime-types to < 3 for older JRubies
2016-04-12 23:54:33 -05:00
Kieran Huggins
82a870d9dc
add guard against including associations for nil objects
2016-03-16 14:39:30 -04:00
Kieran Huggins
ab502f0c52
move @node assignment and the include_associations! call outside the cached response, since including associations produces the side-effect *actually* including the associations.
...
Previously, subsequent renders of a cached serializer would never include associations.
2016-03-16 14:39:30 -04:00
Steve Klabnik
8d31f7ee8c
Bump to 0.8.3
2014-12-10 09:45:29 -05:00
Wouter Willaert
d5226e5978
Fix use of super in define_method
2014-09-21 23:34:44 +02:00
Wouter Willaert
9ebd317898
Remove usage of %i
2014-09-19 17:13:25 +02:00
Wouter Willaert
18667712ea
Support both the _render_option_json and the newer _render_with_renderer_json methods
2014-09-19 10:30:59 +02:00
Steve Klabnik
66d39b6c0a
bump version
2014-09-01 17:00:39 -04:00
Luke Mayhew
cfcd712123
Fix ArraySerializer's output when falling back on DefaultSerializer
...
Change ArraySerializer's initialization of DefaultSerializer to pass
:root => false in order to avoid adding root keys to each of the
items in the array. This ensures consistent results between serializing
arrays of objects with serializers and arrays of objects without
serializers. Fixes #495 .
2014-04-01 22:38:58 -06:00
Gabe da Silveira
36d92804ed
Fix serializer.as_json(nil)
...
This is the form that ActiveSupport 3.1 Object#to_json invokes.
2013-12-30 12:36:18 -06:00
steveklabnik
e81406a248
Revert "First part of a fix for #208."
...
This reverts commit 145b6d499d .
This fix introduced an incompatibility with Rails 3.0.
We'll have to fix it in a different way for older Rails.
2013-05-29 23:25:00 +00: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
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