Sha256: a1d12eed0c19c7b08c51323210c1d1bc88902ff0fc5e9c22447ad12114369b36

Contents?: true

Size: 502 Bytes

Versions: 2

Compression:

Stored size: 502 Bytes

Contents

# encoding: UTF-8
class Rating < ActiveRecord::Base
  RATEABLE_TYPES = %w{}
  RATETOR_TYPES = %w{User}
  belongs_to :rateable, :polymorphic => true
  belongs_to :ratetor, :polymorphic => true

  validates_presence_of :rateable, :ratetor
  validates_inclusion_of :rateable_type, :in => RATEABLE_TYPES
  validates_inclusion_of :ratetor_type, :in => RATETOR_TYPES
  validates_uniqueness_of :ratetor_id, :scope => [:rateable_id, :rateable_type],
    :message => proc {I18n.t('rateable.already_rated')}
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spleen-0.0.2 lib/generators/spleen/templates/model.rb
spleen-0.0.1 lib/generators/spleen/templates/model.rb