This is pretty weird actually, in the show view the name is displayed
(nice!!!), but in the index view (the list of all the posts) it isn't
working yet. The code for the index view (not working) is as I wrote
earlier:

<% @posts.each do |post| %>
  <tr>
    <td><%=h post.client.name %></td>
    <td><%=h post.title %></td>
    [...]

The show view (which works) is like this:

<p>
  <b>Name:</b>
  <%=h @post.client.name %>
</p>

The error generated by the index view:

 Showing app/views/posts/index.html.erb where line #12 raised:

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

Good job Mike that you got it working :) It's pretty hard for me
starting with Rails, coming from a PHP/CodeIgniter background. The
convention over configuration is really great though! I also watched
some screencasts last night, very useful!
--~--~---------~--~----~------------~-------~--~----~
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@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to