On Apr 26, 7:53 am, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> 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

         you mean i should make a  another method "new" inside
controller and "@book =Book.new" should be written there?

Amrit pal

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