Commit Graph

169 Commits

Author SHA1 Message Date
Benjamin Fleischer
9c226c67f1 Rename deprecated empty ActiveModel::TestCase; removed in Rails master 2017-11-02 08:53:46 -05:00
Kieran Huggins
b2dc2598fb add specs for cached attributes 2016-03-16 14:39:30 -04:00
Benjamin Fleischer
75252a2ef9 Run CI against Rails >= 4.0, Ruby >= 1.9.3 2015-12-14 21:59:08 -06:00
Benjamin Fleischer
d03b8179f5 Adjust test for Rails versions that address CVE-2014-4671
Compare
https://github.com/rails/rails/blob/3-2-stable/actionpack/lib/action_controller/metal/renderers.rb#L94
to
https://github.com/rails/rails/blob/4-0-stable/actionpack/lib/action_controller/metal/renderers.rb#L97
2015-12-14 21:51:31 -06:00
mhuggins
e1ae39122c Fix failing tests 2015-12-14 21:48:27 -06:00
Ryunosuke SATO
f77362e9d6 Disabled protect_from_forgery
Because of the following error:
```
ActionController::InvalidCrossOriginRequest: Security warning: an
embedded <script> tag on another site requested protected JavaScript. If
you know what you're doing, go ahead and disable forgery protection on
this action to permit cross-origin JavaScript embedding.
```
2014-09-08 19:09:07 +09:00
Ryunosuke SATO
bb8bedad63 Fix to run tests 2014-09-08 19:04:29 +09:00
Steve Klabnik
1db474963b Remove coveralls.
It's fine, but it's causing issues.
2014-07-04 23:01:26 -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
Steve Klabnik
48e5ca29f1 Add Coveralls for code coverage. 2013-05-05 13:38:56 -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
Gosha Arinich
1482081766 add support of mongoid collection serialization 2013-05-05 21:50:34 +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
vanstee
ef6ab5f0c0 Switch back to the old hash syntax
Just fixed up a couple of hash literals in the tests so that the build
passes for 1.8.7
2013-04-16 22:55:57 -04: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
Sean Abrahams
79acd87829 Use method instead of asssociation_ids if method exists. Fixes #267 2013-04-10 14:38:53 -07:00
Sean Abrahams
a771f30816 If output is as expected, is this assert important? 2013-04-10 14:36:42 -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
ab5d40f38b Sigh.
When I did 9551a97464, I
forgot that some new code may use it.
2013-04-03 23:56:06 -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
f6cf469820 Fix failing tests for edge rails
* Edge Rails returns an instance of 'Gem::Version' for 'Rails.version' due to e600384515dc06db2c56ff5be5c18779f7b379a5
 * Travis build was failing because of this as 'Rails.version.start_with? '4'' was giving 'undefined method' on 'Gem::Version' instance
2013-03-27 10:29:36 +05:30
Prathamesh Sonpatki
75a72b5cc9 Fixed few typos 2013-03-26 20:29:35 +05:30
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
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
Bartek Borkowski
00b5739d38 Add mutual association test 2013-03-15 18:59:05 +01: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
4a5e1e1ae5 Attemp to fix bad test 2013-03-15 08:41:39 +01:00
twinturbo
c3966fe741 ArraySerializer is also cached 2013-03-14 22:54:05 +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
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
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
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
Michi Huber
c7a420d295 Don't fail if object is nil, render null 2013-02-26 11:17:28 +01:00
Michi Huber
58a063eff0 serialization test: respect root settings when root object is nil 2013-02-26 11:12:28 +01:00