Sha256: 2d0e27c769526f26fc711e9eadf4b071f0ad4162c74523001b85f5ac63b84de4

Contents?: true

Size: 670 Bytes

Versions: 5

Compression:

Stored size: 670 Bytes

Contents

class Category < ActiveRecord::Base
  has_and_belongs_to_many :posts
  has_and_belongs_to_many :special_posts, :class_name => "Post"
  has_and_belongs_to_many :hello_posts, :class_name => "Post", :conditions => "\#{aliased_table_name}.body = 'hello'"
  has_and_belongs_to_many :nonexistent_posts, :class_name => "Post", :conditions=>"\#{aliased_table_name}.body = 'nonexistent'"
  
  def self.what_are_you
    'a category...'
  end
  
  has_many :categorizations
  has_many :authors, :through => :categorizations, :select => 'authors.*, categorizations.post_id'
end

class SpecialCategory < Category
  
  def self.what_are_you
    'a special category...'
  end  
  
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
activerecord-1.14.0 test/fixtures/category.rb
activerecord-1.14.2 test/fixtures/category.rb
activerecord-1.14.1 test/fixtures/category.rb
activerecord-1.14.3 test/fixtures/category.rb
activerecord-1.14.4 test/fixtures/category.rb