Sha256: a057269ba89ed2f3b24417b31fa45e723d993f7c8c3be79f32db58ca4538ec54
Contents?: true
Size: 986 Bytes
Versions: 3
Compression:
Stored size: 986 Bytes
Contents
class Topic < ActiveRecord::Base has_many :replies, :dependent => :destroy, :order => 'replies.created_at DESC' belongs_to :author scope :mentions_activerecord, :conditions => ['topics.title LIKE ?', '%ActiveRecord%'] scope :with_replies_starting_with, lambda { |text| { :conditions => "replies.content LIKE '#{text}%' ", :include => :replies } } scope :mentions_activerecord_with_replies, includes(:replies).mentions_activerecord scope :by_title_with_replies, lambda {|title| includes(:replies).where('topics.title like ?', title) } scope :join_replies_by_string, joins('inner join replies on topics.id = replies.topic_id') scope :join_replies_by_string_and_author, join_replies_by_string.joins(:author) scope :join_replies_by_string_and_author_lambda, join_replies_by_string.joins(:author) scope :select_only_id, select('id as super_duper_id').includes(:replies) scope :first_four_sorted_by_date, order('id ASC').order('created_at DESC').limit(4) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fake_arel-1.5.1 | spec/fixtures/topic.rb |
fake_arel-1.5.0 | spec/fixtures/topic.rb |
fake_arel-1.4.0 | spec/fixtures/topic.rb |