instance method save

Ruby on Rails 2.3.18

Since v2.2.3 Last seen in v2.3.18

Available in: v2.2.3 v2.3.18

Signature

save(perform_validation = true)

Saves the model.

If the model is new a record gets created in the database, otherwise the existing record gets updated.

If perform_validation is true validations run. If any of them fail the action is cancelled and save returns false. If the flag is false validations are bypassed altogether. See ActiveRecord::Validations for more information.

There’s a series of callbacks associated with save. If any of the before_* callbacks return false the action is cancelled and save returns false. See ActiveRecord::Callbacks for further details.

Source
# File activerecord/lib/active_record/base.rb, line 2584
      def save
        create_or_update
      end

Defined in activerecord/lib/active_record/base.rb line 2584 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::Base

Type at least 2 characters to search.

↑↓ navigate · open · esc close