method

insert

Importance_0
Ruby on Rails latest stable (v7.1.3.2) - 0 notes - Class: InsertManager
insert(fields) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/arel/insert_manager.rb, line 21
    def insert(fields)
      return if fields.empty?

      if String === fields
        @ast.values = Nodes::SqlLiteral.new(fields)
      else
        @ast.relation ||= fields.first.first.relation

        values = []

        fields.each do |column, value|
          @ast.columns << column
          values << value
        end
        @ast.values = create_values(values)
      end
      self
    end
Register or log in to add new notes.