Class: ActiveRecord::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/activerecord/cte/core_ext.rb

Defined Under Namespace

Classes: Merger

Instance Method Summary collapse

Instance Method Details

#recursive_with=(value) ⇒ Object

Raises:

  • (ImmutableRelation)


57
58
59
60
61
# File 'lib/activerecord/cte/core_ext.rb', line 57

def recursive_with=(value)
  raise ImmutableRelation if @loaded

  @values[:recursive_with] = value
end

#recursive_with?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/activerecord/cte/core_ext.rb', line 53

def recursive_with?
  @values[:recursive_with]
end

#with(opts, *rest) ⇒ Object



29
30
31
# File 'lib/activerecord/cte/core_ext.rb', line 29

def with(opts, *rest)
  spawn.with!(opts, *rest)
end

#with!(opts, *rest) ⇒ Object



33
34
35
36
37
38
39
40
41
# File 'lib/activerecord/cte/core_ext.rb', line 33

def with!(opts, *rest)
  if opts == :recursive
    self.recursive_with = true
    self.with_values += rest
  else
    self.with_values += [opts] + rest
  end
  self
end

#with_valuesObject



43
44
45
# File 'lib/activerecord/cte/core_ext.rb', line 43

def with_values
  @values[:with] || []
end

#with_values=(values) ⇒ Object

Raises:

  • (ImmutableRelation)


47
48
49
50
51
# File 'lib/activerecord/cte/core_ext.rb', line 47

def with_values=(values)
  raise ImmutableRelation if @loaded

  @values[:with] = values
end