vendor/rails/activerecord/test/models/topic.rb in radiant-0.7.2 vs vendor/rails/activerecord/test/models/topic.rb in radiant-0.8.0

- old
+ new

@@ -1,11 +1,18 @@ class Topic < ActiveRecord::Base named_scope :base named_scope :written_before, lambda { |time| - { :conditions => ['written_on < ?', time] } + if time + { :conditions => ['written_on < ?', time] } + end } named_scope :approved, :conditions => {:approved => true} + named_scope :rejected, :conditions => {:approved => false} + + named_scope :by_lifo, :conditions => {:author_name => 'lifo'} + + named_scope :approved_as_hash_condition, :conditions => {:topics => {:approved => true}} named_scope 'approved_as_string', :conditions => {:approved => true} named_scope :replied, :conditions => ['replies_count > 0'] named_scope :anonymous_extension do def one 1 @@ -26,10 +33,12 @@ 2 end end named_scope :named_extension, :extend => NamedExtension named_scope :multiple_extensions, :extend => [MultipleExtensionTwo, MultipleExtensionOne] + + named_scope :by_rejected_ids, lambda {{ :conditions => { :id => all(:conditions => {:approved => false}).map(&:id) } }} has_many :replies, :dependent => :destroy, :foreign_key => "parent_id" serialize :content before_create :default_written_on @@ -62,5 +71,11 @@ if self.new_record? self.author_email_address = 'test@test.com' end end end + +module Web + class Topic < ActiveRecord::Base + has_many :replies, :dependent => :destroy, :foreign_key => "parent_id", :class_name => 'Web::Reply' + end +end \ No newline at end of file