Commit Graph

195 Commits

Author SHA1 Message Date
Gosha Arinich
7f75b15ddd include serializer support into mongoid 2013-05-04 22:43:11 +03: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
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
twinturbo
535a33a33b Have to opt in with #cache_key 2013-03-14 22:40:06 +01:00
twinturbo
e923174a26 #cache_key delegates to #object by default 2013-03-14 22:40:06 +01:00
twinturbo
b4395f281b Add basic caching 2013-03-14 22:40:06 +01:00
Steve Klabnik
6408b73e3c Merge pull request #233 from SamSaffron/fix
Optimised performance for attribute extraction
2013-03-14 14:22:27 -07:00
Sam
710c375088 remove safe guard per discussion with steveklabnik 2013-03-14 14:11:04 -07:00
Michael Rykov
b3a6fa6334 Ensure that ActionController includes MimeResponds 2013-03-14 11:15:14 -07:00
Sam
08a182d743 per discussion remove instrumentation altogether 2013-03-13 22:18:40 -07:00
Sam
31ba6fbb08 Optimised performance for attribute extraction
Disabled all instrumentation unless enabled explicitly
2013-03-13 21:20:56 -07:00
Michael Rykov
37b0690fb8 Add a Responder to handle respond_with(resource) 2013-03-13 16:45:23 -07:00
Steve Klabnik
f4916f113f Merge pull request #223 from tchak/id-serialization-with-hooks
use `read_attribute_for_serialization` to serialize ids
2013-03-08 09:17:19 -08:00
Steve Klabnik
e76a16486f Merge pull request #170 from FundingGates/master
Support optional types for computed attributes
2013-03-08 09:11:29 -08:00
tchak
e2c10f4440 use read_attribute_for_serialization to serialize ids
* in order to allow some optimisation in simple cases, we call `read_attribute_for_serialization` on parent with association_id name
2013-03-08 09:57:42 +01:00
Steve Klabnik
a1755c5b27 Provide a mixin to override AR::Base#to_json
Fixes #192.
2013-03-06 15:32:09 -08:00
Adam Stanton
5a55a6831a Remove line break on the conditional statement. 2013-03-06 11:48:50 -08:00
Adam Stanton
da26ebd26f Merge branch 'create-default-serializer' into HEAD
Conflicts:
	lib/active_model/array_serializer.rb
2013-03-05 21:48:58 -08:00
Steve Klabnik
fabdc621ff bumping to 0.7.0 2013-03-05 17:07:16 -08:00
Steve Klabnik
dc2257977f Merge pull request #198 from jredburn/master
'embed_key' option to allow embedding by attributes other than IDs
2013-03-05 15:57:34 -08:00
Steve Klabnik
06c65871a8 Merge pull request #213 from michihuber/fix_rendering_nil_with_custom_serializer
Fix rendering nil with custom serializer
2013-03-05 15:54:51 -08:00
Jeremy Redburn
7cd7d295e0 Adding 'embed_key' option to allow embedding attributes other than ID 2013-03-05 18:52:31 -05:00
Steve Klabnik
d638e21c8c Merge pull request #180 from fellix/fix-remove-root-globally
Fix global ``` self.root = false ```
2013-03-05 15:48:08 -08:00
Steve Klabnik
95937c6fc7 Merge pull request #167 from GateGuru/feature/specify-association-serializers-as-strings
Add support for specifying the serializer for an association as a String...
2013-03-05 15:04:29 -08:00
Ismael Abreu
2d2094b588 changes to be able to specify multiple attributes with keys 2013-03-05 02:45:22 +00:00