Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom search parameter key changing.. not working #92

Closed
ghost opened this issue Apr 23, 2012 · 10 comments · Fixed by #470
Closed

Custom search parameter key changing.. not working #92

ghost opened this issue Apr 23, 2012 · 10 comments · Fixed by #470

Comments

@ghost
Copy link

ghost commented Apr 23, 2012

I have defined ( as stated in the doc) :
in my controller :
@search_tasks = Task.search(params[:tasks_search], :search_key => :tasks_search)

in my view :
%td= sort_link @search_tasks, :deadline, Task.human_attribute_name(:deadline), {:tasks_page => @tasks_page}, :remote => true

but when click on the sort link, I still get the :q parameter :
params : {"q"=>{"s"=>"deadline asc"}, "tasks_page"=>"1", "action"=>"show", "controller"=>"backoffice/dashboards"}

what could be wrong ?

the generated html link is :
Echéance

@ghost
Copy link
Author

ghost commented Apr 23, 2012

I forked it and check it locally ( debugger in Search initialize ) ... running fine I can have y 2 tabs , with 2 search keys...

so using gem 'ransack' custom search parameter key changing doesn't work
using gem 'ransack', :git => 'git://github.com/ernie/ransack' works !!

so gem ransack (0.6.0) doesn't work ..

@ghost ghost closed this as completed Apr 23, 2012
@lironbeni
Copy link

Not working for me...
no matter if I change the ransack configuration or the call to ransack search in the controller,
the params still sends "q" and not the search_key I've defined...

Here is my ransack.rb initializeer code:

Ransack.configure do |config|
config.search_key = :query
end

And my controller:

@search = User.ransack(params[:query], :search_key => :query)
@Items = @search.result.paginate(:per_page => 20, :page => params[:page] || 1)
@search.build_condition if @search.conditions.empty?
@search.build_sort if @search.sorts.empty?

@ghost
Copy link

ghost commented Oct 19, 2012

Not working for me either.

I'm migrating from MetaSearch and wanted to set the Ransack search_key to :search, but no luck. Adding the Ransack initializer file, and setting the configuration to use config.search_key = :search, still ends up using a search_key of :q.

I've restarted the server to pick up the new initializer, but no luck.

I'm using version 0.7.0
Rails 3.1.8

@qnm
Copy link

qnm commented May 9, 2013

@gladgit Did you manage to get this config value working? I'm having the same issue, migrating from meta_search.

@ghost
Copy link

ghost commented May 9, 2013

@qnm Unfortunately, no. Had to give up on Ransack altogether due to additional issues with it, and time constraints on getting it working.

@gamov
Copy link

gamov commented May 9, 2013

@qnm With what did you replace it?

@ghost
Copy link

ghost commented May 9, 2013

I just reverted to MetaSearch. But that is only supported for Rails 3.1, which is OK for the moment, but I'll have to address this again soon.

@yuryroot
Copy link

I have the same problem.
rails (3.2.12)
ransack (0.7.2)

@ascoppa
Copy link

ascoppa commented Aug 2, 2013

Why was this closed?

@radar
Copy link
Contributor

radar commented Aug 2, 2013

@ascoppa It was closed by the original poster. If you're also seeing this problem, please open a new issue and provide the information from the Contributing Guide

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants