Sha256: 6a7d4713faa665a54417bc3adc7eb30ed06f6b8d4b6ebe5215d39f301466917a

Contents?: true

Size: 1.43 KB

Versions: 16

Compression:

Stored size: 1.43 KB

Contents

require 'authorization'

module <%= module_camel %>
  class V<%= api_version %>::<%= resource_camel %>Serializer < ActiveModel::Serializer
  	embed :ids, include: true

    attributes :id
    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] %>?(current_user,<%= resource_singular %>_object,options)
      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

16 entries across 16 versions & 1 rubygems

Version Path
json_voorhees-0.5.1 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.5.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.9 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.8 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.7 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.6 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.5 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.4 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.3 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.2 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.1 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.4.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.3.9 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.3.6 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.3.5 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb
json_voorhees-0.3.0 lib/generators/json_voorhees/engine_create_serializer/templates/serializer.rb.erb