# Acts\_as\_versioned conflicts?

**URL:** <https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266>\
**Category:** Rails\
**Created:** [November 5, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266 "2007-11-05T17:40:32Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@harm](https://www.ruby-forum.com/u/harm)\
**Post date:** [November 5, 2007, 5:40pm UTC](https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266/1 "2007-11-05T17:40:32Z")

</div>

Dear list,  
At the moment I am building a simple RESTful wiki. For this I am using  
Edge Rails. I have a simple Page model which has a couple of  
associations and acts\_as\_\*. One of them is acts\_as\_versioned and that  
one is misbehaving.  
I should be able to call something like: Page.find\_versions(14), this  
should return an array of Pages, each a different version. However it  
returns an array with elements of the Page::Version class(OK I can  
live with this). Also;

> > p = Page.find(:first)  
> > p.find\_version(1)  
> > Raises an error:  
> > NoMethodError: undefined method `find_version' for #<Page:0x34f57b0> from /*/vendor/rails/activerecord/lib/active_record/ attribute_methods.rb:205:in`method\_missing’  
> > from (irb):54  
> > from :0  
> > And that is correct:
> 
> > p.methods.sort.select {|m| m=~/find/}  
> > =\> []

I am pretty sure I got everything right as I copied most of it from  
Rails Recipes.  
The Page model looks like this:

class Page \< ActiveRecord::Base  
acts\_as\_versioned  
self.non\_versioned\_columns \<\< ‘project\_id’ \<\< ‘project\_user\_id’ \<\<  
‘locked\_by’ \<\< ‘locked\_at’ \<\< ‘created\_at’ \<\< ‘updated\_at’  
acts\_as\_tree #POSSIBLE CONFLICT

belongs\_to :project  
belongs\_to :project\_user

validates\_presence\_of :title, :text, :project\_user, :project

end

Am I doing something really dumb?  
Thanks for any help!

---

<div class="post-metadata">

**Author:** ![harm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@harm](https://www.ruby-forum.com/u/harm)\
**Post date:** [November 6, 2007, 9:38am UTC](https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266/2 "2007-11-06T09:38:39Z")

</div>

Just to loop back on my own post. I no longer believe it is a confict.  
A clean Rails 1.2.5 project with only acts\_as\_versioned also failed to  
find the method ‘find\_version’. This leads me to believe the plugin is  
broken in that respect. Too bad.

---

<div class="post-metadata">

**Author:** ![harm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@harm](https://www.ruby-forum.com/u/harm)\
**Post date:** [November 6, 2007, 4:13pm UTC](https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266/3 "2007-11-06T16:13:58Z")

</div>

On 11/6/07, harm [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Just to loop back on my own post. I no longer believe it is a confict.  
> A clean Rails 1.2.5 project with only acts\_as\_versioned also failed to  
> find the method ‘find\_version’. This leads me to believe the plugin is  
> broken in that respect. Too bad.

It’s a class method, not an instance method. If there was an instance  
method, it might have been removed since it’s no longer necessary.

–  
Rick O.  
[http://lighthouseapp.com](http://lighthouseapp.com)  
[http://weblog.techno-weenie.net](http://weblog.techno-weenie.net)  
[http://mephistoblog.com](http://mephistoblog.com)

---

<div class="post-metadata">

**Author:** ![harm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/b4bc9f/32.png) [@harm](https://www.ruby-forum.com/u/harm)\
**Post date:** [November 14, 2007, 12:10pm UTC](https://www.ruby-forum.com/t/acts-as-versioned-conflicts/119266/4 "2007-11-14T12:10:27Z")

</div>

In that case the Rails Recipes book is wrong. I took recipe 20 and  
there they do something like:

> > chapter = Chapter.new  
> > …
> 
> > chapter.find\_version(1).title

So what is the recommended way to get your hands on an old version?  
I am now using something like this:

> > @page = Page.find(params[:id])  
> > version = Page.find\_version(params[:id],params[:page][:version])  
> > @page.revert\_to(version)

This works but is hardly the way I would expect it to.
