I am looking to use active model serialize on a model called roles, which spits back the roles and that roles permissions. How ever, I want to tell Active Model Serializer that if the role name is Administrator you should never include it in the json of roles returned.
So if I do a show
or a index
action on roles through an api call, I should never see Administrator
in the returned result.
Right now this is all I have for role serialize:
class RoleSerializer < ActiveModel::Serializer
attributes :id, :role
end
Would I do it here or in the controller for index and show? and if so what would I do?