On Fri, Sep 2, 2011 at 6:31 PM, Pab <[email protected]> wrote: > hi > > def search > @employee > end > > i have done the above, but it shows following error > > undefined method `model_name' for NilClass:Class > > Extracted source (around line #1): > > 1: <%= form_for(@employee) do |e| %> > 2: <%= e.error_msg %> > 3: EMP ID<%= e.text_field :id %><br> > 4: <%= e.submit 'search', :controller => 'employees', :action => > 'search1' %> > > you need to set @employee to something, not just declare it like that in the controller.
@employee = Employee.new #or some other model > > thanks, > -pab > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

