Sha256: 65c2fdda146a3665327733b3b0f95355c75e867d32ff431fe8f7ac3d611e82f2

Contents?: true

Size: 1.46 KB

Versions: 17

Compression:

Stored size: 1.46 KB

Contents

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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
json_voorhees-1.5.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.9 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.8 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.7 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.6 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.5 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.2 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.1 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.4.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.3.2 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.3.1 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.3.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-1.0.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.5.5 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.5.4 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.5.3 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.5.2 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb