Sha256: 3164be6bd37f1d6750d51ddf9a1f553e3b465b031fd1f2606300b331b05cd12f
Contents?: true
Size: 804 Bytes
Versions: 6
Compression:
Stored size: 804 Bytes
Contents
class Mingle::Hashtag < ActiveRecord::Base has_many :hashtaggings, class_name: 'Mingle::Hashtagging', dependent: :destroy has_many :facebook_posts, through: :hashtaggings, source: :hashtaggable, source_type: 'Mingle::Facebook::Post' has_many :twitter_tweets, through: :hashtaggings, source: :hashtaggable, source_type: 'Mingle::Twitter::Tweet' has_many :instagram_photos, through: :hashtaggings, source: :hashtaggable, source_type: 'Mingle::Instagram::Photo' validates :tag_name, uniqueness: true, presence: true def tag_name_with_hash return tag_name if tag_name.start_with? "#" "##{tag_name}" end def tag_name_without_hash return tag_name unless tag_name.start_with? "#" tag_name[1..-1] end def usage_count hashtaggings.count end end
Version data entries
6 entries across 6 versions & 1 rubygems