Sha256: 031e09dd8b8ac914b34950c7f8f11dcb231b6a188d4eb21000d73650a5d04903

Contents?: true

Size: 562 Bytes

Versions: 3

Compression:

Stored size: 562 Bytes

Contents

class Mingle::Twitter::Tweet < ActiveRecord::Base
  has_many :hashtaggings, class_name: 'Mingle::Hashtagging', as: :hashtaggable,
    dependent: :destroy

  has_many :hashtags, through: :hashtaggings

  validates :text, :tweet_id, :user_handle, :user_image_url, :user_name, presence: true

  scope :ordered, lambda { order('created_at ASC') }

  before_save :ensure_https_urls

  def author
    user_handle
  end

  def avatar
    user_image_url
  end

  private

  def ensure_https_urls
    self.user_image_url = user_image_url.sub(/http:/, 'https:')
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mingle-0.3.1 app/models/mingle/twitter/tweet.rb
mingle-0.3.0 app/models/mingle/twitter/tweet.rb
mingle-0.2.0 app/models/mingle/twitter/tweet.rb