class ActiveScaffold::Tableless::Relation

Attributes

conditions[R]

Public Instance Methods

except(*skips) click to toggle source
# File lib/active_scaffold/tableless.rb, line 28
def except(*skips)
  super.tap do |new_relation|
    new_relation.conditions = conditions unless skips.include? :where
  end
end
execute_simple_calculation(operation, column_name, distinct) click to toggle source
# File lib/active_scaffold/tableless.rb, line 42
def execute_simple_calculation(operation, column_name, distinct)
  @klass.execute_simple_calculation(self, operation, column_name, distinct)
end
find_one(id) click to toggle source
# File lib/active_scaffold/tableless.rb, line 38
def find_one(id)
  @klass.find_one(id, self)
end
initialize_copy(other) click to toggle source
# File lib/active_scaffold/tableless.rb, line 9
def initialize_copy(other)
  @conditions = @conditions.dup
  super
end
merge(r) click to toggle source
# File lib/active_scaffold/tableless.rb, line 22
def merge(r)
  super.tap do |merged|
    merged.conditions.concat r.conditions unless r.nil? || r.is_a?(Array)
  end
end
to_a() click to toggle source
# File lib/active_scaffold/tableless.rb, line 34
def to_a
  @klass.find_all(self)
end
where(opts, *rest) click to toggle source
# File lib/active_scaffold/tableless.rb, line 14
def where(opts, *rest)
  unless opts.blank?
    opts = opts.with_indifferent_access if opts.is_a? Hash
    @conditions << (rest.empty? ? opts : [opts, *rest])
  end
  self
end

Public Class Methods

new(klass, table) click to toggle source
# File lib/active_scaffold/tableless.rb, line 4
def initialize(klass, table)
  super
  @conditions ||= []
end