Hi Guys ,
I am a newbie to rails so forgive me if this has been
answered before. I am currently doing an inventory management project
on RoR and got 3 tables , goods , customers and staff. I used scaffold
to generate all of them.
I just generated a new scaffold called search and I
need to search values from all 3 tables. i am using the steps from
this site ,
http://wiki.rubyonrails.org/rails/pages/HowToImplementSearch
The only change is from Person/people to Book/books .But I keep
getting this error
You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each
Can someone help? The places where I put the codes are below ,
def search
query = params[:q]
@people = Person.find(:all, :conditions => [“name = ?”, query])
end
is in search_controller.rb
the codes for view are in view/search/index.rhtml and search.rhtml.
Thank you so much!!
regards
billy