When I change it to "Tutorial.next_lesson" it then says: undefined method `nil_class_path'
Is this because I have to "pass in the tutorial_id and category_id" or is it a different problem? As for acts_as_list, I would prefer not to use it for now and just keep with using position; However it is something I will be looking at for future projects.. Please Help, Sorry for being such a pain, Thanks In Advance, Joe On May 6, 4:48 pm, Michael Pavling <pavl...@gmail.com> wrote: > On 6 May 2010 16:41, Joe <j...@dev-hq.co.uk> wrote: > > > def self.next_lesson > > find :all, :conditions => ["position > ? AND category_id = ?", > > @tutorial_id, @category_id], :order => 'position', :limit => 1 > > end > > > and then this code in the link: > > > <%= link_to 'Next lesson.', @tutorial.next_lesson %> > > using "self" in the method name makes it a class method; so accessible > with "Tutorial.next_lesson". But you'd have to pass in the tutorial_id > and category_id. > > Seriously - someone much earlier suggested using acts_as_list. Do. It > deals with all of this for you... > > -- > 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-t...@googlegroups.com. > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscr...@googlegroups.com. > For more options, visit this group > athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- 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-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.