Can one have conditional except, only or include options when rendering? So, like in the example below:
render json: @post,
except: [:author]
Is it possible to have that except option or a similar option be conditional?
Ideally, something along the lines of a conditional way of doing this that allows me to deal with many different conditions and cases.
Like maybe something like:
render json: @post,
except: return_excluded_keys
return_excluded_keys
function could return keys that need to be excluded.
I am using Rails 4.2.6 and Active Model Serializers 0.9.3.