Sha256: 078c8ecc42b85a9366cb3f0d4d00889add3e57e2d637fdc3803467c31c83188d

Contents?: true

Size: 408 Bytes

Versions: 3

Compression:

Stored size: 408 Bytes

Contents

class User < ActiveRecord::Base
  has_many :readings
  has_many :articles, :through => :readings

  has_many :comments, :as => :person
  has_one :first_comment, :as => :person, :class_name => "Comment"

  has_one :moderator, :foreign_key => :id, :inverse_of => :user
  delegate :admin, :to => :moderator, :allow_nil => true

  def find_custom_articles
    articles.where("name = ?", "Article One")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
composite_primary_keys-14.0.9 test/fixtures/user.rb
composite_primary_keys-14.0.8 test/fixtures/user.rb
composite_primary_keys-14.0.7 test/fixtures/user.rb