Module: ActiveRecord::ActsAs::ScopeForCreate

Defined in:
lib/active_record/acts_as/querying.rb

Instance Method Summary collapse

Instance Method Details

#scope_for_create(attributes = nil) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/active_record/acts_as/querying.rb', line 47

def scope_for_create(attributes = nil)
  return super() unless acting_as?

  scope = respond_to?(:values_for_create) ? values_for_create(attributes) : where_values_hash
  scope.merge!(where_values_hash(acting_as_model.table_name))
  scope.merge!(attributes) if attributes
  scope.merge(create_with_value)
end