Sha256: 77cfc4f3fb1dd1125d387d6d55d389bb446508a9fac4ce0744b71d77b76bd85d

Contents?: true

Size: 422 Bytes

Versions: 1

Compression:

Stored size: 422 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

1 entries across 1 versions & 1 rubygems

Version Path
composite_primary_keys-14.0.10 test/fixtures/user.rb