# Vestal\_versions -- can I set it to ignore certain columns?

**URL:** <https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096>\
**Category:** Rails\
**Created:** [September 16, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096 "2010-09-16T19:04:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 16, 2010, 7:04pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/1 "2010-09-16T19:04:55Z")

</div>

I’d like my published boolean to be excluded from the calculation as  
to whether a version is created or not. Can anyone suggest a way to do  
that?

Thanks,

Walter

---

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 16, 2010, 11:16pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/2 "2010-09-16T23:16:02Z")

</div>

On Sep 16, 10:04 am, Walter Lee D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’d like my published boolean to be excluded from the calculation as  
> to whether a version is created or not. Can anyone suggest a way to do  
> that?

Digging into the code a bit, it appears you can specify options to  
ignore certain columns.

In lib / vestal\_versions / creation.rb,  
# Returns an array of column names that should be included in  
the changes of created  
# versions. If vestal\_versions\_options[:only] is  
specified, only those columns  
# will be versioned. Otherwise, if  
vestal\_versions\_options[:except] is specified,  
# all columns will be versioned other than those specified.  
Without either option, the  
# default is to version all columns. At any rate, the four  
“automagic” timestamp columns  
# maintained by Rails are never versioned.  
def versioned\_columns  
case  
when vestal\_versions\_options[:only] then  
self.class.column\_names & vestal\_versions\_options[:only]  
when vestal\_versions\_options[:except] then  
self.class.column\_names - vestal\_versions\_options[:except]  
else self.class.column\_names  
end - %w(created\_at created\_on updated\_at updated\_on)  
end

---

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 16, 2010, 11:32pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/3 "2010-09-16T23:32:26Z")

</div>

Thanks, that’s really helpful, but I’m not sure how to pass this on to  
vestal\_versions. I’ve tried all manner of arguments to the versioned  
command, is that not the right place to do this?

class Page \< ActiveRecord::Base  
versioned :options =\> {:except =\> :publish}

(also tried just :except =\> ‘publish’, bunch of variations on that  
theme…)

I’m using version 0.8.0 if that makes any difference.

Thanks in advance,

Walter

---

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 16, 2010, 11:47pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/4 "2010-09-16T23:47:04Z")

</div>

I’m looking through the versions on Github – and it looks like the  
latest versions might have this, while my older version does not. Gem  
refuses to update me further than this point, probably because I’m  
stuck on Ruby 1.8.6 on this machine.

Walter

---

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 16, 2010, 11:56pm UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/5 "2010-09-16T23:56:26Z")

</div>

This is crazy. The version jump from 1.0.1 to 1.0.2 includes a  
dependency on Ruby 1.8.7, which I don’t have. I did manage to update  
to 1.0.1, we’ll see if this works now…

Walter

---

<div class="post-metadata">

**Author:** ![walterdavis](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/w/a587f6/32.png) [@walterdavis](https://www.ruby-forum.com/u/walterdavis)\
**Post date:** [September 17, 2010, 12:36am UTC](https://www.ruby-forum.com/t/vestal-versions-can-i-set-it-to-ignore-certain-columns/195096/6 "2010-09-17T00:36:14Z")

</div>

Finally figured it out. Updating the gem meant a significant change in  
the database, as well as a method I had been using becoming protected.  
After a bit of hacking and swearing, I have the desired result.  
Checking the Publish control no longer forces a new version. Thanks  
for your help!

Walter
