Sha256: 17d022133f9297ef18da9f8a6ad810d9f83186fb5ce2a9f7c83f17613ca43c97

Contents?: true

Size: 643 Bytes

Versions: 2

Compression:

Stored size: 643 Bytes

Contents

class Micropost < ActiveRecord::Base
  belongs_to :user
  default_scope -> { order('created_at DESC') }
  MAGIC_ID_NUMBER = 90
  MAGIC_ID_STRING = 'F-1'

  module DoNotIncludeInMock

  end
  include DoNotIncludeInMock
  # self.primary_key = :lol
  # self.table_name = :posts
  # Returns microposts from the users being followed by the given user.
  def self.from_users_followed_by(user=nil)
    followed_user_ids = "SELECT followed_id FROM relationships
                         WHERE follower_id = :user_id"
    where("user_id IN (#{followed_user_ids}) OR user_id = :user_id",
          user_id: user.id)
  end

  def display_name

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_mocker-1.4.2 sample_app_rails_4/app/models/micropost.rb
active_mocker-1.4.1 sample_app_rails_4/app/models/micropost.rb