module Tableless::Association
Public Class Methods
included(base)
click to toggle source
# File lib/active_scaffold/tableless.rb, line 45 def self.included(base) base.alias_method_chain :association_scope, :tableless base.alias_method_chain :target_scope, :tableless end
Public Instance Methods
association_scope_with_tableless()
click to toggle source
# File lib/active_scaffold/tableless.rb, line 50 def association_scope_with_tableless @association_scope ||= overrided_association_scope if klass < ActiveScaffold::Tableless association_scope_without_tableless end
overrided_association_scope()
click to toggle source
# File lib/active_scaffold/tableless.rb, line 55 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_scope_with_tableless()
click to toggle source
# File lib/active_scaffold/tableless.rb, line 63 def target_scope_with_tableless target_scope_without_tableless.tap do |scope| if klass < ActiveScaffold::Tableless class << scope; include RelationExtension; end end end end