require 'authorization' module <%= module_camel %> class V<%= api_version %>::<%= resource_camel %>Serializer < ActiveModel::Serializer embed :ids, include: true attributes :id <% attributes.each do |pair| %> attributes :<%= pair.split(/:/)[0] %> <% end %> attributes :created_at attributes :updated_at #has_one :bulletin #has_many :posts def include_id? return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_id?(current_user,object,@options) end <% attributes.each do |pair| %> def include_<%= pair.split(/:/)[0] %>? return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_created_at?(current_user,object,@options) end <% end %> def include_created_at? return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_created_at?(current_user,object,@options) end def include_updated_at? return ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_updated_at?(current_user,object,@options) end def include_associations! #include! :bulletin if ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_bulletin?(current_user,object,@options) #include! :posts if ::Authorization::<%= module_camel %>::V<%= api_version %>::<%= resource_camel %>.include_posts?(current_user,object,@options) end end end