Skip to content

.pre_save ? #42

@AlexGM

Description

@AlexGM

Greetings!

I'm back to ROR and happy to use SimpleRecord again.

I've faced with some issue. To avoid database inconsistency, I need to track method transaction and save all created objects only if the whole method did succeed.

To do it, I need to create new SimpleRecord objects, but save all of them only at the method's end.
Problem that the objects has no .id until being saved.

I've found .pre_save method and tried to use them as .pre_save({})
Looks like it does work as expected.

Please clarify - is this correct usage and do I need to pass any options for my case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions