Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling update on a record should call save as well. #84

Closed
zeisler opened this issue Aug 26, 2016 · 1 comment
Closed

Calling update on a record should call save as well. #84

zeisler opened this issue Aug 26, 2016 · 1 comment

Comments

@zeisler
Copy link
Owner

zeisler commented Aug 26, 2016

ActiveRecord Code

# Updates the attributes of the model from the passed-in hash and saves the
    # record, all wrapped in a transaction. If the object is invalid, the saving
    # will fail and false will be returned.
def update(attributes)
      # The following transaction covers any possible database side-effects of the
      # attributes assignment. For example, setting the IDs of a child collection
  with_transaction_returning_status do
    assign_attributes(attributes)
    save
  end
end

ActiveMocker::Base Code

def update(attributes = {})
  assign_attributes(attributes)
end

Calling update should save the record if it was not already persisted.

@zeisler
Copy link
Owner Author

zeisler commented Aug 28, 2016

#85

@zeisler zeisler closed this as completed Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant