title: Simple search form for my blog with ruby and sinatra
body: <p>I'm using sequel.
  In my app.rb, I wrote </p>
  
  <pre><code>get '/search'  do
    @post = Post.find(:Title =&gt; "%#{params[:query]}%")
    erb :'layout'
  end
  </code></pre>
  
  <p>Layout.erb</p>
  
  <pre><code>&lt;form action="/search" method="get"&gt;
    &lt;input type="text" name="query"/&gt;&lt;br /&gt;   
    &lt;input type="submit" /&gt;
  &lt;/form&gt;
  
  &lt;% if @results %&gt;
  &lt;table&gt;
    &lt;%@results.each do |r|%&gt;
    &lt;tr valign="top"&gt;
      &lt;td&gt;&lt;%=r.title%&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;%end%&gt;
  &lt;/table&gt;
  &lt;% end %&gt;
  </code></pre>
  
  <p>And to the blog_model.rb in post class this:</p>
  
  <pre><code>def self.search(query)
    #where(:title, query) -&gt; This would return an exact match of the query
    where("title like ?", "%#{query}%") 
  end
  </code></pre>
  
  <p>And I'm getting this :LocalJumpError at /search
  no block given (yield).
  So what to do or have I done this code correctly ? Thanks in advance.</p>