Sha256: 5d4341110d26bdd02fc47e50fb5fafd597a0abb42f3e4daab98d277cb1990d47
Contents?: true
Size: 1.03 KB
Versions: 1
Compression:
Stored size: 1.03 KB
Contents
module Granite module Form module Model module Associations module PersistenceAdapters class ActiveRecord < Base class ReferencedProxy < Granite::Form::Model::Associations::Collection::Proxy # You can't create data directly through ActiveRecord::Relation METHODS_EXCLUDED_FROM_DELEGATION = %w[build create create!].map(&:to_sym).freeze attr_reader :association delegate :scope, to: :@association def method_missing(method, *args, &block) delegate_to_scope?(method) ? scope.send(method, *args, &block) : super end def respond_to_missing?(method, include_private = false) delegate_to_scope?(method) || super end private def delegate_to_scope?(method) METHODS_EXCLUDED_FROM_DELEGATION.exclude?(method) && scope.respond_to?(method) end end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
granite-form-0.6.0 | lib/granite/form/model/associations/persistence_adapters/active_record/referenced_proxy.rb |