We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
When saving a versioned model for the first time, a version is created regardless of the :if condition.
:if
E.g. if I do
acts_as_versioned :if => Proc.new {|item| false}
I will still get a new record in the _versions table when calling the first save() (or create()) on my model.
_versions
save()
create()
I suppose there's a reason for this, but from my point of view when the :if condition is false no version should be saved, ever.
I think the behavior stems from line 391 in acts_as_versioned.rb.
acts_as_versioned.rb
@saving_version = new_record? || save_version?
Why do new records get to bypass the version saving conditions?
The text was updated successfully, but these errors were encountered:
I dont remember... I guess so there's always an initial versioned record? I can't believe anyone still uses this :)
Sorry, something went wrong.
According to my tests it is possible to honour the :if condition and still get correct results. I'll submit a pull request momentarily.
While we're at it, do you know of any other gem that does the same job as yours and is actively supported? :)
Nope. I'm sure there's something out there.
No branches or pull requests
When saving a versioned model for the first time, a version is created regardless of the
:if
condition.E.g. if I do
I will still get a new record in the
_versions
table when calling the firstsave()
(orcreate()
) on my model.I suppose there's a reason for this, but from my point of view when the
:if
condition is false no version should be saved, ever.I think the behavior stems from line 391 in
acts_as_versioned.rb
.Why do new records get to bypass the version saving conditions?
The text was updated successfully, but these errors were encountered: