Class: ActiveRecord::Relation

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

Defined Under Namespace

Classes: Merger

Instance Method Summary collapse

Instance Method Details

#recursive_with=(value) ⇒ Object

Raises:

  • (ImmutableRelation)


55
56
57
58
59
# File 'lib/ahoy_captain/active_record.rb', line 55

def recursive_with=(value)
  raise ImmutableRelation if @loaded

  @values[:recursive_with] = value
end

#recursive_with?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/ahoy_captain/active_record.rb', line 51

def recursive_with?
  @values[:recursive_with]
end

#with(opts, *rest) ⇒ Object



27
28
29
# File 'lib/ahoy_captain/active_record.rb', line 27

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

#with!(opts, *rest) ⇒ Object



31
32
33
34
35
36
37
38
39
# File 'lib/ahoy_captain/active_record.rb', line 31

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



41
42
43
# File 'lib/ahoy_captain/active_record.rb', line 41

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

#with_values=(values) ⇒ Object

Raises:

  • (ImmutableRelation)


45
46
47
48
49
# File 'lib/ahoy_captain/active_record.rb', line 45

def with_values=(values)
  raise ImmutableRelation if @loaded

  @values[:with] = values
end