Skip to content

#update_attributes uses #update_all inside it #87

@ebihara99999

Description

@ebihara99999

Sorcery::Adapters::ActiveRecordAdapter#update_attributes uses #update_all inside instead of simply #update.
I think it intends one active record object to be updated because the code does it, so #updated_all is not necessary.

If I open a PR, I plan to change from

@model.class.where(:"#{primary_key}" => @model.send(:"#{primary_key}")).update_all(attrs)

to

@model.class.find_by(:"#{primary_key}" => @model.send(:"#{primary_key}")).update(attrs)

The good points are:

  • keep the code simple
  • return boolean, not integer ( seems more understandable to me )

Thank you for watching, I would appreciate it if someone gives me suggestion.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions