This commit is contained in:
albert
2012-02-20 14:56:27 -05:00
parent af8c939f7b
commit 0151d21470
2 changed files with 3 additions and 2 deletions

View File

@@ -46,7 +46,8 @@ class Post < ActiveRecord::Base
scope :tag_match, lambda {|query| PostQueryBuilder.new(query).build}
scope :positive, where("score > 1")
scope :negative, where("score < -1")
search_methods :tag_match
scope :updater_name_matches, lambda {|name| where("updater_id = (select _.id from users _ where lower(_.name) = ?)", name.downcase)}
search_methods :tag_match, :updater_name_matches
scope :after_id, Proc.new {|num|
if num.present?
where("id > ?", num.to_i).reorder("id asc")

View File

@@ -4,7 +4,7 @@
<div id="search">
<%= simple_form_for(@search) do |f| %>
<%= f.input :updater_name_eq, :label => "User", :required => false %>
<%= f.input :updater_name_matches, :label => "User", :required => false %>
<%= f.input :post_id_eq, :label => "Post", :required => false %>
<%= f.button :submit, :value => "Search" %>
<% end %>