Rub on Rails Question

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:

Click on a composer’s name
3: to see all of that composer’s works.


4:

    5: <% @composers.each do |composer| %>
    6:
  • <%= link_to “#{composer.first_name} #{composer.last_name}”,
    7: :controller => “composer”,
    8: :action => “show”,

Bala P. ïèøåò:

You might have expected an instance of Array.
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 are right, welcome method was empty. Thank you.

Sorry, it was 2pm at night (I posted it just before I went to sleep)

Bala P. 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 :slight_smile:

All the Best!
Sergey.

rub on rails…
sounds kind of relaxing. :wink:

On 9/28/06, Bala P. [email protected] wrote:


Ross R.
www.sorrylies.com

Bala P. wrote:

Oops, I did it again. All right it was 2am in the morning.
Are ya’ll satisfied now?

More then. :slight_smile:

Oops, I did it again. All right it was 2am in the
morning.
Are ya’ll satisfied now?