Sha256: fc2004c02fa6bac62b5e21da2347f7a7ea3bfb0f914db5dc3b64027e12b13af0
Contents?: true
Size: 677 Bytes
Versions: 43
Compression:
Stored size: 677 Bytes
Contents
module ActiveAdmin module ScopeChain # Scope an ActiveRecord::Relation chain # # Example: # scope_chain(Scope.new(:published), Article) # # => Article.published # # @param scope The <ActiveAdmin::Scope> we want to scope on # @param chain The ActiveRecord::Relation chain or ActiveRecord::Base class to scope # @return <ActiveRecord::Relation or ActiveRecord::Base> The scoped relation chain # def scope_chain(scope, chain) if scope.scope_method chain.public_send scope.scope_method elsif scope.scope_block instance_exec chain, &scope.scope_block else chain end end end end
Version data entries
43 entries across 43 versions & 6 rubygems