Would I be correct in saying it's because the model method doesn't expect to be given any parameters, or is it a different problem? It would seem that other people with errors of this kind are having different problems.
Please Help, Thanks In Advance, Joe On May 7, 7:20 am, Joe <j...@dev-hq.co.uk> wrote: > Please note I've also tried this: Tutorial.next_lesson(@tutorial.id, > @tutorial.category_id) > > Which results in some compile errors: wrong number of arguments (2 for > 0) > > I guess this is because my model doesn't take any parameters, and I'm > giving it 2... > > I'll be looking around for how I can make it accept 2 parameters (or > fix the previous error) but it would be nice if someone could help > out, > > Thanks In Advance, > > Joe > > On May 6, 8:00 pm, Joe <j...@dev-hq.co.uk> wrote: > > > > > I did try using: "@tutorial.next_lesson" before, however I got this > > error so figured it must be wrong: undefined method `next_lesson' > > > I don't quite know why it can't find the method since it's obviously > > in the model... > > > Has anyone got a solution for this? > > > Thanks In Advance, > > > Joe > > > On May 6, 5:30 pm, Frederick Cheung <frederick.che...@gmail.com> > > wrote: > > > > On May 6, 5:23 pm, Joe <j...@dev-hq.co.uk> wrote:> 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? > > > > You're probably getting nil_class_path because you are returning nil > > > from somewhere. > > > You definitely need to pass in the values of tutorial_id - that class > > > method isn't going to be stealing instance variables out of the > > > controller or anything like that. > > > Personally I'd have next_lesson be an instance method of tutorial > > > > link_to 'Next', @tutorial.next_lesson > > > > sounds nicer than > > > > link_to 'Next', Tutorial.next_lesson(@tutorial.id, > > > @tutorial.category_id) > > > > or anything like that. > > > > Fred > > > > -- > > > 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 > > 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 > 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.