Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [ransack]

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

0 votes
1 answer
67 views

Can I pass an argument and sort using ransack

"I want to display the exact ID at the top when searching. For example: select * from user order by user.id = 25 DESC, created_at DESC; How can I implement this using ransack?"
Kuri's user avatar
  • 29
0 votes
0 answers
48 views

How to sort result when i use search params in ransack rails gem?

Hello i've working on a rails app ( a marketplace for sports teachers ) For moment its work well when i use only sort like this : http://localhost:3000/capsules?q%5Bs%5D=price_cents+asc http://...
codeCaps's user avatar
1 vote
1 answer
100 views

Search Rails 7 ActiveStorage filename with Ransack

I have a Rails 7.1.3 app that has ActiveStorage and Ransack installed. I have a model called Upload that has_one_attached :file. I would like to search by filename, using Ransack, in the uploads/index ...
hashrocket's user avatar
  • 2,222
0 votes
0 answers
30 views

Not filter records after active admin and ransack updation

I have recently updated activeadmin and ransack gem, below code snippets is working fine with active admin and ransack gem using version : active admin- 2.13.1 ransack: >= 2.1 , < 4 when I ...
Abhishek Tanwar's user avatar
0 votes
0 answers
44 views

Ransack query is returning wrong quantity of objects

I have this ransack query: SchoolTeacher.ransack(school_classrooms_id_eq: 1134).result.count it should filter objects of SchoolTeacher where classroom_id os 1134. SchoolTeacher belongs_to School. ...
Gabriel de França Tavares's user avatar
0 votes
1 answer
88 views

How to search in rails 7 with ransack when action text rich text using in the Post model?

Could somebody help me to figure out why it is not working? So what is the story: there is a rails 7 (7.1.3) blog app with a ransack version 4.1.1 In the search form, I need to search text by the post ...
Yurii's user avatar
  • 53
1 vote
1 answer
43 views

Sorting using ransack, through association and aggregation method

I have such connections in models class User < ApplicationRecord has_many :support_user_orders, dependent: :destroy end class SupportUserOrder < ApplicationRecord belongs_to :user end I ...
Taras Rogulya's user avatar
1 vote
1 answer
146 views

Creating an activeadmin filter on a scope in ransackable_scopes

I'd like to create an activeadmin filter on a page for a model that has an association with the User model. I'd like to use the custom scope matches_name, which combines the first_name and last_name ...
Dan Monego's user avatar
-1 votes
1 answer
36 views

How do i make a search using ransack gem without pressing the enter key or submitting the form

the code works well but i need it to initiate search and filter Model Items just by pressing the key and probably creating a 1 second delay before filter. this is my html.erb search snippet <%= ...
morris menanya's user avatar
0 votes
1 answer
63 views

Search with Rails Ransack Gem: implement a 2 sec search delay while searching with Ransack

I have a Search feature with Ransack which works well. but I am trying to implement it in a way that the search feature filters a particular user model after about a second or two while typing the ...
morris menanya's user avatar
0 votes
1 answer
60 views

Ransack search not returning expected results with enum field in Rails

I'm facing an issue with Ransack search in my Rails application when attempting to filter results based on an enum field. Despite implementing what appears to be a correct setup, the search doesn't ...
Usama Ahmad's user avatar
0 votes
0 answers
48 views

How to search through a polymorphic relationship

I have the following model: class Measurement < ApplicationRecord belongs_to :service end And this other one: class Service < ApplicationRecord belongs_to :serviceable, polymorphic: ...
Nathan Moreira's user avatar
0 votes
0 answers
41 views

Active Admin filters not displaying on screen but present in the html DOM

Filters in AA usually works smoothly. I did notice that when i override scoped_collection method, the whole filter sidebar tends to disappear from the screen but still loaded in the DOM. I don't have ...
Ouska's user avatar
  • 17
0 votes
1 answer
346 views

Undefined method error for an instance of Ransack::Search

I am creating a new Rails app, i created an admin page for Users with active_admin gem, when trying to access the page I keep getting this error ActionView::Template::Error (undefined method `...
IshAsh's user avatar
  • 99
0 votes
2 answers
430 views

Unable to load ActiveAdmin models with Ransack 4

I'm getting the infamous: Ransack needs ActiveStorage::Attachment attributes explicitly allowlisted as searchable. Define a ransackable_attributes class method in your ActiveStorage::Attachment model....
mystic cola's user avatar
  • 1,551

15 30 50 per page
1
2 3 4 5
52