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

.pre_save ? #42

Open
AlexGM opened this issue Dec 26, 2011 · 0 comments
Open

.pre_save ? #42

AlexGM opened this issue Dec 26, 2011 · 0 comments

Comments

@AlexGM
Copy link

AlexGM commented Dec 26, 2011

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?

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