区分大小写的搜索限制了结果

case sensitive search is limiting results

我正在尝试修改我的搜索,以便如果用户搜索 "wrangler",他们将获得与搜索 "Wrangler" 相同的结果。数据库的第一个字母大写,所以我想如果小写字母我需要大写我的搜索..不知道如何完成这个---基本上,我不希望大写字母在搜索时发挥作用。

我的搜索表单:

<%= form_for(@post) do |f| %>
  <% if @post.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>

      <ul>
      <% @post.errors.full_messages.each do |message| %>
        <li><%= message %></li>
      <% end %>
      </ul>
    </div>
  <% end %>

  <div class="field">
    <%= f.label :heading %><br>
    <%= f.text_field :heading %>
  </div>
  <div class="field">
    <%= f.label :body %><br>
    <%= f.text_area :body %>
  </div>
  <div class="field">
    <%= f.label :price %><br>
    <%= f.text_field :price %>
  </div>
  <!--<div class="field">
    <%= f.label :neighborhood %><br>
    <%= f.text_field :neighborhood %>
  </div> -->
  <div class="field">
    <%= f.label :external_url %><br>
    <%= f.text_field :external_url %>
  </div>
  <div class="field">
    <%= f.label :timestamp %><br>
    <%= f.text_field :timestamp %>
  </div>
  <div class="actions">
    <%= f.submit %>
  </div>
<% end %>

我的帖子管理员:

class PostsController < ApplicationController
  before_action :set_post, only: [:show, :edit, :update, :destroy]

def home
end

  # GET /posts
  # GET /posts.json
  def index
    @posts = Post.order('timestamp DESC').paginate(:page => params[:page], :per_page => 50)
    @posts = @posts.where(model: params["model"]) if params["model"].present?
    @posts = @posts.where(year: params["year"]) if params["year"].present?
    @posts = @posts.where(neighborhood: params["neighborhood"]) if params["neighborhood"].present?
    @posts = @posts.where("price > ?", params["min_price"]) if params["min_price"].present?
    @posts = @posts.where("price < ?", params["max_price"]) if params["max_price"].present?
    @posts = @posts.where(transmission: params["transmission"]) if params["transmission"].present?
    @posts = @posts.where(title_status: params["title_status"]) if params["title_status"].present?
  end

  # GET /posts/

这是一个小例子。

@posts = @posts.where( all, :conditions => ["lower(model) =?", params["model"].downcase]) if params["model"].present?

这里发生了什么 lower(field_name) 使字段的值小写

params[:name].downcase 使值小写

@posts = @posts.where( all, :conditions => ["lower(model) =?", params["model"].downcase]) if params["model"]。现在?