Skip to content

Ransack form search field value not persisted between requests when using alias #689

Open
@fidalgo

Description

@fidalgo

When I search, using an alias I cannot get the value of the searched parameter in the field.
In the name field I have tested and it's working fine.
My code:
In controller:

  def index
    @q = Customer.ransack(params[:q])
    @customers = @q.result(distinct: true)
  end

In model:

  ransack_alias :quick_search, :name_or_phone_or_mobile_or_email_or_vat_identification

In view:

      <%= search_form_for @q do |f| %>
      <%= f.search_field :quick_search_cont, class: "form-control"%>
    </div>
    <div id="table-filter" class="well filter-well">
      <div class="form-group">
        <%= f.label (:name) %>
        <%= f.search_field :name_cont, class: "form-control" %>
      </div>

Ransack version:
GIT
remote: git://github.com/activerecord-hackery/ransack.git
revision: 64d8c40

I'm using Ransack directly with:
Database: PostgreSQL
Rails: 5.0.0.rc1
ruby 2.2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions