Sha256: 55561225b6b683b04676ee2ee24e0b5ac84f41d7e3f39e6a4bc43858edc7c14a

Contents?: true

Size: 1.51 KB

Versions: 9

Compression:

Stored size: 1.51 KB

Contents

require 'authorization/v<%= api_version %>/<%= HorsePower.get_singular(resource_name) %>'

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

9 entries across 9 versions & 1 rubygems

Version Path
horse_power-1.0.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.9.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.8.5 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.8.3 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.8.2 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.8.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.8.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.7.1 lib/generators/horse_power/serializer/templates/serializer.rb.erb
horse_power-0.7.0 lib/generators/horse_power/serializer/templates/serializer.rb.erb