I'm trying to implement a form to search through the title of my posts.
This is the controller code:
post '/search' do
@results = Post.all(:Title.like => "%#{params[:query]}%")
erb :layout
end
This is the layout.erb code:
<form action="/search" method="post">
<input type="text" name="query"/><br />
<input type="submit" />
</form>
<% if @results %>
<table>
<%@results.each do |r|%>
<tr valign="top">
<td><%=r.Title%></td>
</tr>
<%end%>
</table>
<% end %>
I get an error saying 'undefined method `like' for: Title: Symbol'.