Module: PlainModel::Querying::Where

Extended by:
ActiveSupport::Concern
Included in:
PlainModel::QueryBuilder
Defined in:
lib/plain_model/querying/where.rb

Instance Method Summary collapse

Instance Method Details

#initial_valuesObject



10
11
12
# File 'lib/plain_model/querying/where.rb', line 10

def initial_values
  super.merge where: []
end

#where(*conditions) ⇒ Object

Chain method

Parameters:

  • conditions (Array)

Returns:

  • new instance with applied changes



17
18
19
# File 'lib/plain_model/querying/where.rb', line 17

def where(*conditions)
  dup.where!(*conditions)
end

#where!(*conditions) ⇒ Object

Chain method

Parameters:

  • conditions (Array)

Returns:

  • current instance with applied changes



24
25
26
27
# File 'lib/plain_model/querying/where.rb', line 24

def where!(*conditions)
  values[:where] = (values[:where] + conditions).uniq
  self
end