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
7
votes
1 answer

Ransack and acts-as-taggable-on issues

I`ve got a model with several taxonomies using acts-as-taggable-on class Film < ActiveRecord::Base attr_accessible :mood_list, :genre_list, :tag_list, :country_list acts_as_taggable_on :countries, :genres, :moods, :tags end I`m trying to make…
7
votes
1 answer

Rails, Ransack: How to search HABTM relationship for "all" matches instead of "any"

I'm wondering if anyone has experience using Ransack with HABTM relationships. My app has photos which have a habtm relationship with terms (terms are like tags). Here's a simplified explanation of what I'm experiencing: I have two photos: Photo 1…
Andrew
  • 42,517
  • 51
  • 181
  • 281
6
votes
4 answers

rails ransack gem to search json column

I have a field as json column and i have to search all the phone values inside that column, i have searched for it and i have not found any document using ransack. Is it possible to use ransaack to search json column? I have used the ransack to…
Anbazhagan P
  • 125
  • 1
  • 10
6
votes
0 answers

Ransack Search Ajax in Application Layout Rails

I have a Rails 4.2 app in which I'm using Ransack mixed with Geocoder for search. I want to use an Ajax (remote: true) for my search to avoid pageloads and changing of the URL. When I implement this in my index view it works great, but I want to…
nulltek
  • 3,247
  • 9
  • 44
  • 94
6
votes
0 answers

In Ransack, how to write a custom ransacker to search by count of associated models

(This is a more specified version of the question that I asked previously but that has not received any answers; I hope it's not against SO’s rules) Given that I have a Rails 4 app that has a Sponsor model and a Sponsorship model, so that a sponsor…
azangru
  • 2,644
  • 5
  • 34
  • 55
6
votes
1 answer

Rails+ActiveAdmin - filtering with ransacker throws an error PG::SyntaxError: ERROR: syntax error at or near ","

I have a project on Ruby on Rails 4.1.4, using activeadmin 1.0.0.pre from git://github.com/activeadmin/activeadmin, pg 0.17.1, PostgreSQL 9.3 In the project I have these models: class User has_one :account class Account belongs_to :user …
chaimann
  • 193
  • 1
  • 8
6
votes
1 answer

Custom ActiveAdmin filter for Date Range

I need to create a custom ActiveAdmin filter for a Date Range which belongs to another resource. I want to filter a list of users by a date range of when they completed a survey. I've declared a custom filter in the ActiveAdmin DSL like so: filter…
6
votes
1 answer

Rails 4 + Ransack: lteq does not work well with datetime?

I have a ransack search form:

Scheduled Payments

<%= search_form_for [:admin, @search] do |form| %> <%= form.text_field :start_date_gteq, value: @order_date_gteq_with_proper_format, class: "datepicker" %> to <%= form.text_field…
bigpotato
  • 26,262
  • 56
  • 178
  • 334
6
votes
2 answers

Search for a null value using Ransack 'eq' predicate

Using the 'eq' predicate with a blank value, Ransack will cancel out that predicate. Which is obviously handy to have an "All" option in your select. But what if I want to add an option in my