Skip to content

changed_attributes returning inconsistent data #487

@marceloeloelo

Description

@marceloeloelo

Let's say I have an Account model which has some varchar columns. I'm seeing strange behavior when calling changed_attributes:

> Account
# => Account(ID: integer, Name: varchar, Address: string)

> account = Account.find(1)
# => #<Account ID: 1, Name: "ABCDE", Address: "123 Street">

> account.changed_attributes
# => {}

> account.save
# => true

> account.changed_attributes
# => { "Name" => "ABCDE" }

As you can see, there was no change to the Name attribute but it's still being included in the changed_attributes response after the account object was saved.

@metaskills I can't explain this, do you have an idea on what might be going on? Have you experienced any similar issue with varchar?

Thanks

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