Module: ActiveScaffold::Tableless::Tableless

Defined in:
lib/active_scaffold/tableless.rb

Instance Method Summary collapse

Instance Method Details

#association_scopeObject



58
59
60
61
# File 'lib/active_scaffold/tableless.rb', line 58

def association_scope
  @association_scope ||= overrided_association_scope if klass < ActiveScaffold::Tableless
  super
end

#overrided_association_scopeObject



63
64
65
66
67
68
69
# File 'lib/active_scaffold/tableless.rb', line 63

def overrided_association_scope
  if AssociationScope.respond_to?(:scope) # rails >= 4.1
    AssociationScope.scope(self, klass.connection)
  else # rails < 4.1
    AssociationScope.new(self).scope
  end
end

#target_scopeObject



71
72
73
74
75
76
77
# File 'lib/active_scaffold/tableless.rb', line 71

def target_scope
  super.tap do |scope|
    if klass < ActiveScaffold::Tableless
      class << scope; include RelationExtension; end
    end
  end
end