Open ehannes opened 8 years ago
PR's welcome :) Let me know if you'd like any guidance. There are some other similar feature requests that have been posted.
By the way, you should try 0.10.2, esp if you're using caching.
I started down this road here https://github.com/rails-api/active_model_serializers/pull/1714
But there was an issue with applying conditionals in multiple attributes
definitions. Check out the thread and see if you'd like to pick it up. I was planning on doing so soon, but am short for time at the moment.
Expected behavior vs actual behavior
I expect conditionals for
attribute
andattributes
to behave the same, but they don't. An example:This gives me
TypeError ({:if=>"admin_signed_in?"} is not a symbol nor a string):
If I change this it to
attribute
in singular, it works!Environment
ActiveModelSerializers Version (commit ref if not on tag):
0.10.0
Output of
ruby -e "puts RUBY_DESCRIPTION"
:ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
OS Type & Version: Ubuntu 16.04
Integrated application and version (e.g., Rails, Grape, etc): Rails 4.2.4