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

deleted_in_original_table method #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

johannesthoma
Copy link

Dear technoweenie and team,

We are using acts_as_versioned in our campus management platform of the technical
university of vienna (tiss.tuwien.ac.at) and are very happy with it.

I wrote a small convenience method that given a version model checks if
the original record has already been deleted. Test is also included in this patch.

Please feel free to pull the patch if you like, it should work out-of-the box.

All the best,

  • Johannes

This method returns true when the record of a version model has been deleted
in the original table. Test is also included in this patch.
#
def deleted_in_original_table
not original_class.exists?(self.send original_class.versioned_foreign_key)
end
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's going on with this indentation? Do you mind fixing that?

@johannesthoma
Copy link
Author

Hi there,

Hope that's ok now, don't know how this happened ..

  • Johannes

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

Successfully merging this pull request may close these issues.

3 participants