title: retrieve data from database in rails?
body: <p>I have two tables called events and trainers in my project.events table contain trainer's id. I have drop down menu which contains trainer's name as follows.</p>
  
  <pre><code>&lt;% form_tag "/events/find_trainer" do %&gt;
  &lt;%= collection_select("event", "trainer", @trainers , :id, :name, {:prompt =&gt; true}) %&gt;
  &lt;%= submit_tag "search" %&gt;
  &lt;%end%&gt;
  </code></pre>
  
  <p>then i created find_trainer method in controller to retrieve data of events table.</p>
  
  <pre><code>def find_trainer
  @events=Event.find(:all, :conditions=&gt; { :trainer=&gt;params[:id]})
    end
  </code></pre>
  
  <p>This will not retrieve anything from the database.i am using postgresql and ruby 1.8.7 and rails 2.3.8 versions. I could not understand my fault.. Can anybody help me? </p>