I am getting the following error when I point the browser to http://localhost:3000 I have checked the composers table and it has two records. Can someone please help me to fix this problem? TIA NoMethodError in Main#welcome Showing app/views/main/welcome.rhtml where line #5 raised: You have a nil object when you didn''t expect it! You might have expected an instance of Array. The error occured while evaluating nil.each Extracted source (around line #5): 2: <p>Click on a composer''s name 3: to see all of that composer''s works.</p> 4: <ul> 5: <% @composers.each do |composer| %> 6: <li><%= link_to "#{composer.first_name} #{composer.last_name}", 7: :controller => "composer", 8: :action => "show", --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bala Paranj ïèøåò:> I am getting the following error when I point the browser to http://localhost:3000 > > I have checked the composers table and it has two records. Can someone please help me to fix this > problem? TIA > > NoMethodError in Main#welcome > > Showing app/views/main/welcome.rhtml where line #5 raised: > > You have a nil object when you didn''t expect it! > You might have expected an instance of Array. > The error occured while evaluating nil.each > > Extracted source (around line #5): > > 2: <p>Click on a composer''s name > 3: to see all of that composer''s works.</p> > 4: <ul> > 5: <% @composers.each do |composer| %> > 6: <li><%= link_to "#{composer.first_name} #{composer.last_name}", > 7: :controller => "composer", > 8: :action => "show", > >You should have prepared that array (@composers) in controllers "welcome" method: app/controllers/main_controller.rb class MainController < ApplicationController def welcome @composers = Composer.find(:all) end end --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
You are right, welcome method was empty. Thank you. --- Maxim Kulkin <maxim.kulkin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> app/controllers/main_controller.rb > class MainController < ApplicationController > def welcome > @composers = Composer.find(:all) > end > end > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
rub on rails..... sounds kind of relaxing. ;-) On 9/28/06, Bala Paranj <bparanj-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> > You are right, welcome method was empty. Thank you. > > --- Maxim Kulkin <maxim.kulkin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > app/controllers/main_controller.rb > > class MainController < ApplicationController > > def welcome > > @composers = Composer.find(:all) > > end > > end > > > > > > > > > > > > > >-- Ross Riley www.sorrylies.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 -~----------~----~----~----~------~----~------~--~---
Sorry, it was 2pm at night (I posted it just before I went to sleep) --- Ross Riley <riley.ross-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > rub on rails..... > sounds kind of relaxing. ;-) >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bala Paranj wrote:> Sorry, it was 2pm at night (I posted it just before I went to sleep) >2pm at night is even more relaxing, but management do not allows me to sleep at that time :) All the Best! Sergey.> --- Ross Riley <riley.ross-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > >> rub on rails..... >> sounds kind of relaxing. ;-) >> >>--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Oops, I did it again. <Seinfield Tone On> All right it was 2am in the morning.<Seinfield Tone Off> Are ya''ll satisfied now? --- Sergey Kuznetsov <rails-9a/WvBvX2Qpg9hUCZPvPmw@public.gmane.org> wrote:> > Bala Paranj wrote: > > Sorry, it was 2pm at night (I posted it just before I went to sleep) > > > 2pm at night is even more relaxing, but management do not allows me to > sleep at that time :) > > > All the Best! > Sergey.--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Bala Paranj wrote:> Oops, I did it again. <Seinfield Tone On> All right it was 2am in the morning.<Seinfield Tone Off> > Are ya''ll satisfied now? >More then. :)> --- Sergey Kuznetsov <rails-9a/WvBvX2Qpg9hUCZPvPmw@public.gmane.org> wrote: > > >> Bala Paranj wrote: >> >>> Sorry, it was 2pm at night (I posted it just before I went to sleep) >>> >>> >> 2pm at night is even more relaxing, but management do not allows me to >> sleep at that time :) >> >> >> All the Best! >> Sergey. >> > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---