search option for 1 to many relationships

5 views
Skip to first unread message

Roy

unread,
May 22, 2012, 10:01:10 PM5/22/12
to rubyonra...@googlegroups.com
I made 1 to many relation ships with school and professor....search option is working for professor but not for school. here are the erorrs and my code...please help---

ActiveRecord::RecordNotFound in ProfessorsController#index

Couldn't find School without an ID

Rails.root: /home/vmuser/workspace/project3 -3

Application Trace | Framework Trace | Full Trace
app/controllers/professors_controller.rb:15:in `index'


codes in controller:
def index

        @school=School.find(params[:id])
          @professor =@school.professors.build
         @professors =Professor.search(params[:search])
end
 
codes in index:
<%= form_tag professors_path, :method => :get do %>
  <p>
    <%= text_field_tag :search, params[:search] %>
    <%= submit_tag "Search", :name => nil %>
<% end %>


Reply all
Reply to author
Forward
0 new messages