Commit Graph

186 Commits

Author SHA1 Message Date
Santiago Pastorino
fa61314d0e Add AR integration tests 2013-10-18 17:49:18 -02:00
Santiago Pastorino
4c7599cfff Use more meaningful model names for tests 2013-10-18 17:49:18 -02:00
Santiago Pastorino
516f5bdceb Implement has_one's embed ids include true 2013-10-18 17:49:18 -02:00
Santiago Pastorino
52bb3f6929 Implement has_one's embed objects 2013-10-18 17:49:17 -02:00
Santiago Pastorino
d756ae4a70 Implement has_one's and serialize_ids 2013-10-18 17:49:17 -02:00
Santiago Pastorino
01bc534976 Remove SerializerSupport 2013-10-18 17:49:17 -02:00
Santiago Pastorino
0d4dfb69a9 Fix directories the project is on top level dir 2013-10-18 17:49:17 -02:00
Santiago Pastorino
0c91564101 Remove method redefined warning 2013-10-18 17:49:17 -02:00
Santiago Pastorino
93baaa96b1 Implement meta and meta_key for AM::Serializer 2013-10-18 17:49:17 -02:00
Santiago Pastorino
af357619c1 Add AMS support to AR objects 2013-10-18 17:49:17 -02:00
Santiago Pastorino
a25c352525 Move models and serializers in test to fixtures.rb file 2013-10-18 17:49:17 -02:00
Santiago Pastorino
0d3b56e9cf Implement AC integration 2013-10-18 17:49:17 -02:00
Santiago Pastorino
d41e5ccef7 Implement SerializerSupport class 2013-10-18 17:49:17 -02:00
Santiago Pastorino
45453f638b Tests refactor 2013-10-18 17:49:17 -02:00
Santiago Pastorino
b6f9c5ee43 Implement Serializer's scope 2013-10-18 17:49:16 -02:00
Santiago Pastorino
c3f857d1b6 Implement Serializer's root 2013-10-18 17:49:16 -02:00
Santiago Pastorino
7143eb8301 Serialize just attributes 2013-10-18 17:49:16 -02:00
Santiago Pastorino
14f51f2ea9 Remove everything, rewrite of AMS starts here 2013-10-18 17:46:18 -02:00
Damian Galarza
0d674369ff Use minitest/autorun
Allows edge gemset to build
2013-06-04 19:17:31 -04:00
Tee Parham
c3fa96456c upgrade hash syntax in tests 2013-05-30 15:25:06 -06:00
Tee Parham
143e5d9866 do not generate id method (was for 1.8 only)
see https://github.com/rails-api/active_model_serializers/issues/127
for original motivation
2013-05-29 19:39:00 -06:00
Santiago Pastorino
c97acfd9ba Always set a serializer for each item of an Array
model.active_model_serializer could return nil so we need to ensure that
if serializer is not setted we set DefaultSerializer to it.

This reverts commit 64ed05c484.

Fixes #318
2013-05-28 18:13:07 -07:00
Santiago Pastorino
f68003f64d Merge pull request #313 from geigerzaehler/fix_root
Don't wrap array items in root element
2013-05-24 14:49:41 -07:00
Santiago Pastorino
9521e912fe serialize_ids call methods on the corresponding serializer if defined 2013-05-24 14:09:27 -07:00
Thomas Scholtes
258248d6c0 Don't wrap array items in root element 2013-05-24 10:23:59 +02:00
Damian Galarza
bbc3ae44cc Allow a controller to properly override scope_name 2013-05-21 21:24:50 -04:00
Santiago Pastorino
1a8709d71c Move caching to a new module 2013-05-21 17:03:06 -07: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