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! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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. On Nov 5, 5:39 pm, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> 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!--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 11/6/07, harm <harmaarts-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Olson http://lighthouseapp.com http://weblog.techno-weenie.net http://mephistoblog.com --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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).titleSo 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. On Nov 6, 4:12 pm, "Rick Olson" <technowee...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 11/6/07, harm <harmaa...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> 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 Olsonhttp://lighthouseapp.comhttp://weblog.techno-weenie.nethttp://mephistoblog.com--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---