class ActiveRecord::Relation

def create(attributes = nil, &block)

Experimental RBS support (using type sampling data from the type_fusion project).

def create: (Class klass, *Array[] args, **Hash kwargs) -> untyped

This signature was generated using 5 samples from 1 application.

# => #
users.create(name: nil) # validation on name

# => #
users.create { |user| user.name = 'tenderlove' }

users.create # => #
users.create(name: 'fxn')

users.create # => #
users = User.where(name: 'Oscar')

==== Examples

{ActiveRecord::Base.create}[rdoc-ref:Persistence::ClassMethods#create].
Expects arguments in the same format as

defined in the relation. Returns the initialized object if validation fails.
Tries to create a new record with the same scoped attributes
def create(attributes = nil, &block)
  if attributes.is_a?(Array)
    attributes.collect { |attr| create(attr, &block) }
  else
    block = current_scope_restoring_block(&block)
    scoping { _create(attributes, &block) }
  end
end