Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_or.rb

Constant Summary collapse

IS_RAILS3_FLAG =
Gem::Version.new(ActiveRecord::VERSION::STRING) < Gem::Version.new('4.0.0')
IS_RAILS5_FLAG =
Gem::Version.new(ActiveRecord::VERSION::STRING) >= Gem::Version.new('5.0.0')

Instance Method Summary collapse

Instance Method Details

#or(*other) ⇒ Object



11
12
13
# File 'lib/rails_or.rb', line 11

def or(*other)
  return rails5_or(rails_or_parse_parameter(*other))
end

#or_having(hash) ⇒ Object



49
50
51
# File 'lib/rails_or.rb', line 49

def or_having(hash)
  self.or(rails_or_spwan_relation(:having, hash))
end

#or_not(*args) ⇒ Object

Works in Rails 4+



45
46
47
# File 'lib/rails_or.rb', line 45

def or_not(*args) # Works in Rails 4+
  self.or(klass.where.not(*args))
end

#rails5_orObject



10
# File 'lib/rails_or.rb', line 10

alias_method :rails5_or, :or