This commit is contained in:
Toks
2013-05-11 20:53:11 -04:00
parent ddfa019c4c
commit cc17c9ce55
2 changed files with 16 additions and 3 deletions

View File

@@ -47,6 +47,10 @@ class UserFeedback < ActiveRecord::Base
q = q.where("creator_id = (select _.id from users _ where lower(_.name) = ?)", params[:creator_name].mb_chars.downcase)
end
if params[:category].present?
q = q.where("category = ?", params[:category])
end
q
end
end

View File

@@ -3,9 +3,18 @@
<h1>Search User Feedbacks</h1>
<%= form_tag(user_feedbacks_path, :method => :get, :class => "simple_form") do %>
<%= search_field "user_name", :label => "User" %>
<%= search_field "creator_name", :label => "Creator" %>
<%= submit_tag "Search" %>
<div class="input">
<%= search_field "user_name", :label => "User" %>
<%= search_field "creator_name", :label => "Creator" %>
<label for="search_category">Category</label>
<%= select "search", "category", %w(positive negative neutral) %>
</div>
<div class="input">
<%= submit_tag "Search" %>
</div>
<% end %>
</div>
</div>