On 26 Apr 2011, at 12:28, amrit pal pathak <amritpalpath...@gmail.com> wrote:

> 
> 
> On Apr 26, 5:55 am, Frederick Cheung <frederick.che...@gmail.com>
> wrote:
>> On Apr 26, 10:21 am, amrit pal pathak <amritpalpath...@gmail.com>
>> wrote:
>> 
>> 
>> 
>>>                              is it saying @book variablei is nil?
>>>    it is defined in controller as :
>> 
>>>  class BookController < ApplicationController
>>>   def index
>>>   @book =Book.new
>>>   end
>>>   end
>> 
>> Your index action defines @book, but you're testing the "new" action.
>                Correspond to index action i have index file which
> hold following code and i can access this file successfully but when i
> click on "New book",it gives the error

Yes, we know that. What you don't seem to grasp is that because the new page is 
being displayed the index method isn't called (the new method, if it exists 
will be called) so @book isn't set

Fred

> <h1>Books are coming soon!</h1>
> 
> <h1>Listing Books</h1>
> 
> <table>
>  <tr>
>    <th>Title</th>
>    <th>Summary</th>
>    <th></th>
>    <th></th>
>    <th></th>
>  </tr>
> </table>
> <br />
> <%= link_to 'New book', new_book_path%>
> 
> 
>>>                                                 One thing more,in
>>> new.html.erb,i have written "render 'form' ",but there is no such file
>>> (view).The file there is _form.html.erb.Is it correct?
>> 
>> That's ok - rails will work that bit out.
> 
>      Ok .but if i change the name from _form to form ,is will ok?
> 
> Thanks
> 
> -- 
> 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.
> 

-- 
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