Questions tagged [ransack]

Ransack is a Ruby gem that enables object-based searching against an application's models.

Ransack enables the creation of both simple and advanced search forms against an application's models.

It is a rewrite of MetaSearch, though while it supports many of the same features as MetaSearch, its underlying implementation differs greatly from MetaSearch, and backwards compatibility is not a design goal.

The Ransack Github repository is https://github.com/activerecord-hackery/ransack#readme

759 questions
0
votes
1 answer

Ransack's collection_select and HABTM return undefined method

I've been looking over my code over and over again and I can't see my problem. I have two Models Person and Credential. They have a HABTM relationship. Person class Person < ActiveRecord::Base attr_accessible :credential_ids …
Mundo Calderon
  • 183
  • 2
  • 10
0
votes
1 answer

Default attribute_select and predicate_select using ransack

I'm using the Ransack gem in Rails and would like to show a default attribute select (e.g. 'name' pre-selected on the dropdown) and also a default predicate (e.g. 'contains'). The idea is to allow the user to quickly query the user model by…
Mark Kenny
  • 1,598
  • 2
  • 17
  • 30
0
votes
1 answer

How to discard initial / default select option after first search with Ransack

If I specify a default :selected value for months/years below, then it always reverts to these after search. Is there a way to have the selects set to the selection for the search performed rather than the default after the page loads after the…
danebez
  • 353
  • 4
  • 15
0
votes
1 answer

Grab Search Parameters from Ransack Gem Rails 3

I am using Ransack Search Gem for Rails3. Is there a way to grab the search parameters that the user typed into the search box? I'd like to make it available in my view if necessary. Thanks!
grigerny
  • 3
  • 2
0
votes
1 answer

Ransack not working with polymorphic column type (uninitialized constant)

I have set up Ransack as per http://railscasts.com/episodes/370-ransack?view=asciicast and it's functioning fine to search most of the columns in the Orders table using the orders#index controller. However, it won't search orderable_type or…
Nick
  • 839
  • 1
  • 10
  • 19
0
votes
1 answer

Searching with Ransack - records not getting rendered, despite being in instance variable

I am trying to put a search facility on a Users Index page in a Rails application (similar to that in Michael Hartl's Rails Tutorial) and am using the Ransack gem to do the search. It's just a simple search on the user's name that I've implemented…
0
votes
1 answer

Ransack opposite predicate :present

Ransack has abilities finding User that has a first_name: User.search(:first_name_present => "1") and the opposite, finding User with no first_name or blank: User.search(:first_name_blank => "1") . Unfortunately, User.search(:first_name_present…
raymondralibi
  • 1,933
  • 1
  • 17
  • 25
0
votes
1 answer

Modifying param key to use query twice in controller

I'm using Ransack to run search on my app. I've got a search bar that users input text to, the text is passed to a search controller where I search for the query in two tables: Posts and Groups The problem is that I want to run the query on :name…
Brian
  • 285
  • 2
  • 21
0
votes
0 answers

Matching all conditions ransack

I'm trying to filter my users for their knowledge in foreign languages. I have the LanguageSkill model which belongs to Member, Language and LanguageLevel. class LanguageSkill < ActiveRecord::Base attr_accessible :member_id, :language_id,…
Renan
  • 1,910
  • 4
  • 22
  • 36
0
votes
1 answer

How can I include more fields to where condition using ransack?

I'm building a query using ransack predicates, so that means I need a lot of conditions for a WHERE clause SQL-wise. Here's what I have as a Hash of conditions for ransanck's search method: This is the console output of…
jlstr
  • 2,986
  • 6
  • 43
  • 60
0
votes
1 answer

ransack gem rails 3

i am getting stuck with using the gem ransack. I have placed ransack in my gemfile and then run bundle install ( though i used just bundle, does that make a difference? i didnt think it did?) Next i have placed this in my Recipe controller def…
Richlewis
  • 15,070
  • 37
  • 122
  • 283
0
votes
1 answer

Rails - Ransack - Reorder Attributes

I am using the Ransack gem in my Rails application. It is working as expected, but how can I reorder the list of attributes in the dropdown box for the attribute select? Unfortunately for me, "Name" of the User is near the bottom of the list, when…
ardavis
  • 9,842
  • 12
  • 58
  • 112
0
votes
1 answer

In form sorting using ransack gem not working

I've been trying (unsuccessfully so far) to use the out of the box in-form sorting provided by the ransack gem, and the result of it unfortunately is an empty form. Here's what I've done so far: Controller: class LandingController <…
jlstr
  • 2,986
  • 6
  • 43
  • 60
0
votes
1 answer

Can I use Ransack to search for the same value in multiple columns?

Can the Ransack gem generate a SQL search of multiple columns for the same value? For instance, something like "users where the first name OR the last name contains 'James'".
Nathan Long
  • 122,748
  • 97
  • 336
  • 451
0
votes
1 answer

Editng gem Ransack?

How I can edit gem Ransack ? as I know the steps are : unpack gem (done) modify the code as require (done) build the gem ( got problem ) how to build gem ransack which I modified ? I am refering this…
1 2 3
50
51