Sha256: 0ba76b1f22ac12e5a2aa2c99e0e1ac3c1207626013ad21beb02e039b56b3e91d

Contents?: true

Size: 337 Bytes

Versions: 1

Compression:

Stored size: 337 Bytes

Contents

class BrainstormingIdeaSerializer < ActiveModel::Serializer
  attributes :id, :user_id, :user_slug, :user_name, :name, :text, :arguments, :votes_count

  def user_slug
    object.user.try(:slug)
  end
  
  def user_name
    object.user.try(:name)
  end
  
  def arguments
    object.arguments.map{|a| ArgumentSerializer.new(a)}
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voluntary_brainstorming-0.0.2 app/serializers/brainstorming_idea_serializer.rb