Sha256: 34bde4e0863070a5010f376b8ccf546a2661d4bce4520c2faa56c4db349938a6

Contents?: true

Size: 649 Bytes

Versions: 9

Compression:

Stored size: 649 Bytes

Contents

class User < ActiveRecord::Base
  belongs_to :employer

  belongs_to :manages_company, :class_name => "Company"
  counter_culture :manages_company, :column_name => "managers_count"
  belongs_to :has_string_id
  counter_culture :has_string_id

  has_many :reviews
  accepts_nested_attributes_for :reviews, :allow_destroy => true

  default_scope do
    if _default_scope_enabled
      joins("LEFT OUTER JOIN companies").uniq
    else
      all
    end
  end

  class << self
    attr_accessor :_default_scope_enabled

    def with_default_scope
      @_default_scope_enabled = true
      yield
      @_default_scope_enabled = false
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
counter_culture-1.2.0 spec/models/user.rb
counter_culture-1.1.1 spec/models/user.rb
counter_culture-1.1.0 spec/models/user.rb
counter_culture-1.0.0 spec/models/user.rb
counter_culture-0.2.3 spec/models/user.rb
counter_culture-0.2.2 spec/models/user.rb
counter_culture-0.2.1 spec/models/user.rb
counter_culture-0.2.0 spec/models/user.rb
counter_culture-0.1.34 spec/models/user.rb