NoMethodError

I am receiving this error messagek

NoMethodError in Story#index

Showing app/views/story/index.rhtml where line #2 raised:

You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.size Extracted source (around line #2):

1: <h2> 2: <%= "Showing #{ pluralize(@stories.size, 'story', 'stories') }" %> 3: </h2> 4: <%= render :partial => 'story', :collection => @stories %>

Any help would be appreciated. Thanks.

Zkidd wrote:

I am receiving this error messagek

NoMethodError in Story#index

Showing app/views/story/index.rhtml where line #2 raised:

You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.size Extracted source (around line #2):

1: <h2> 2: <%= "Showing #{ pluralize(@stories.size, 'story', 'stories') }" %> 3: </h2> 4: <%= render :partial => 'story', :collection => @stories %>

Any help would be appreciated. Thanks.

@stories is nil. Make sure the query or whatever object that variable is pointing at is not nil.