title: simple search with rails
body: <p>hy 
   i try to create a simple search on my application </p>
  
  <p><strong>calendar.rb</strong></p>
  
  <pre><code>def self.search(search_condition)
    search_condition = "%" + search + "%"
    find( :all, :conditions =&gt; ['city like ?', search_condition])
  end
  </code></pre>
  
  <p><strong>calendar_controller.rb</strong></p>
  
  <pre><code>def index
    @search = @user.calendar.search(params[:search_condition])
    @content_calendars = @user.calendar.all
    @content_calendars_by_dates = @content_calendars.group_by(&amp;:published_on)
    @date = params[:date] ? Date.parse(params[:date]) : Date.today
  end
  </code></pre>
  
  <p>the partial <strong>_search.html.erb</strong></p>
  
  <pre><code>&lt;%= form_tag root_path, :method =&gt; 'get'  do %&gt;
    &lt;%= text_field_tag :search, params[:search_condition], :id =&gt; 'search_field' %&gt;
    &lt;%= submit_tag "Search", :name =&gt; nil %&gt;   
  &lt;% end %
  </code></pre>
  
  <p>when i try i get this error:</p>
  
  <p><code>The request method POST is inappropriate for the URL /.</code>
   i dont understand why ?</p>
  
  <p><strong>rake routes</strong></p>
  
  <pre><code>user_calendars GET    /users/:user_id/calendars(.:format)   calendars#index
  
  POST   /users/:user_id/calendars(.:format)          calendars#create
  
  new_user_calendar GET    /users/:user_id/calendars/new(.:format)      calendars#new
  
  edit_user_calendar GET    /users/:user_id/calendars/:id/edit(.:format) calendars#edit
  
  user_calendar GET    /users/:user_id/calendars/:id(.:format)      calendars#show
  </code></pre>