nil object where not expected

trying to pass a collection of authors using <%= render :partial => 'author', :collection => @authors %>

_authors.rhtml file has

<tr>   <td><%= link_to author.name, :action => 'show', :id => @author %></

  <td><%= link_to 'Edit', :action => 'edit', :id => author %></td>   <td>     <%= button_to 'Delete', {:action => 'destroy', :id => author},         :confirm =>           "Are you sure you want to delete author #{author.name}?" %>   </td> </tr>

in def index     @authors = Author.find(:all)     @page_title = 'Listing authors' end

and I'm getting

You have a nil object when you didn't expect it! The error occurred while evaluating nil.author

Extracted source (around line #2):

1: <tr> 2: <td><%= link_to @post.author.name, :action => 'show', :id => @author %></td> 3: <td><%= link_to 'Edit', :action => 'edit', :id => author %></td> 4: <td> 5: <%= button_to 'Delete', {:action => 'destroy', :id => author},

any ides what I may be doing wrong here ?

Dave wrote:

trying to pass a collection of authors using <%= render :partial => 'author', :collection => @authors %>

_authors.rhtml file has

<tr>   <td><%= link_to author.name, :action => 'show', :id => @author %></ >   <td><%= link_to 'Edit', :action => 'edit', :id => author %></td>   <td>     <%= button_to 'Delete', {:action => 'destroy', :id => author},         :confirm =>           "Are you sure you want to delete author #{author.name}?" %>   </td> </tr>

in def index     @authors = Author.find(:all)     @page_title = 'Listing authors' end

and I'm getting

You have a nil object when you didn't expect it! The error occurred while evaluating nil.author

Extracted source (around line #2):

1: <tr> 2: <td><%= link_to @post.author.name, :action => 'show', :id => @author %></td> 3: <td><%= link_to 'Edit', :action => 'edit', :id => author %></td> 4: <td> 5: <%= button_to 'Delete', {:action => 'destroy', :id => author},

any ides what I may be doing wrong here ?

Where is @post being set?

@post is not being set, I'm a rails newbie @post was one of the solutions I found on google, but none are solving my problem this the error I get

You have a nil object when you didn't expect it! The error occurred while evaluating nil.name

Extracted source (around line #2):

1: <tr> 2: <td><%= link_to author.name, :action => 'show', :id => @author %></td> 3: <td><%= link_to 'Edit', :action => 'edit', :id => author %></td> 4: <td> 5: <%= button_to 'Delete', {:action => 'destroy', :id => author},

Hi!

If the partial is called 'author', then the file must be called '_author.rhtml'

Andrey

Thanks for the help got it working...