Thanks so much! It works! However now I'm just trying to get the whole 'next lesson' thing working.
I've tried it using this code in the model: 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 %> However I get this error: undefined method `next_lesson' Why is this happening? and how do I overcome it? Thanks for your help, Joe On May 6, 3:48 pm, Michael Pavling <pavl...@gmail.com> wrote: > On 6 May 2010 15:46, Joe <j...@dev-hq.co.uk> wrote: > > > I've tried copying this code into the tutorials_controller: > > > def self.ordered_by_position > > find :all, :order => 'position' > > end > > If you're calling "Tutorial.ordered_by_position" that code needs to be > in the Tutorial model, not in a controller... > > -- > 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.