Sha256: 47c0d5f1bba50bb4f987471b258c8d879ee381a81df51bcc06abc01c44534a13

Contents?: true

Size: 415 Bytes

Versions: 8

Compression:

Stored size: 415 Bytes

Contents

class ActivityVerb < ActiveRecord::Base
  # Activity Strems verbs
  Available = %w( post update like )

  validates_uniqueness_of :name

  has_many :activities

  scope :verb_name, lambda{ |n|
    where(:name => n)
  }

  class << self
    def [] name
      if Available.include?(name)
        find_or_create_by_name name
      else
        raise "ActivityVerb not available: #{ name }"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
social_stream-0.4.0 app/models/activity_verb.rb
social_stream-0.3.6 app/models/activity_verb.rb
social_stream-0.3.5 app/models/activity_verb.rb
social_stream-0.3.4 app/models/activity_verb.rb
social_stream-0.3.3 app/models/activity_verb.rb
social_stream-0.3.2 app/models/activity_verb.rb
social_stream-0.3.1 app/models/activity_verb.rb
social_stream-0.3.0 app/models/activity_verb.rb