Sha256: eb808d90cccfb3e23c6d6be290582312d92811f7b6f18e72330cd48606e5a9a3

Contents?: true

Size: 1.44 KB

Versions: 15

Compression:

Stored size: 1.44 KB

Contents

require 'authorization'

class V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>Serializer < ActiveModel::Serializer
	embed :ids, include: true

  attributes :id
<% attributes.each do |pair| -%>
  attributes :<%= HorsePower.get_column(pair) %>
<% end -%>
  attributes :created_at
  attributes :updated_at
  #has_one :bulletin
  #has_many :posts

  def include_id?
  	return ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_id?(current_user,object,@options)
  end

<% attributes.each do |pair| -%>
  def include_<%= HorsePower.get_column(pair) %>?
    return ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_<%= HorsePower.get_column(pair) %>?(current_user,object,@options)
  end

<% end -%>
  def include_created_at?
    return ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_created_at?(current_user,object,@options)
  end

 def include_updated_at?
    return ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_updated_at?(current_user,object,@options)
  end

  def include_associations!
    #include! :bulletin if ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_bulletin?(current_user,object,@options)
    #include! :posts if ::Authorization::V<%= api_version %>::<%= HorsePower.get_camel(resource_name) %>.include_posts?(current_user,object,@options)
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
horse_power-0.6.5 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.6.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.5.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.4.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.4.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.3.3 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.3.2 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.2.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.2.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.1.6 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.1.5 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.1.2 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.1.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.1.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.0.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb