All Questions
Tagged with activeadmin ransack
63 questions
0
votes
0
answers
39
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 ...
1
vote
1
answer
341
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 ...
0
votes
0
answers
55
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 ...
1
vote
1
answer
597
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 `...
1
vote
2
answers
582
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....
3
votes
0
answers
337
views
undefined method `table_name' for #<Arel::Table in ActiveAdmin/ransack
I was able to reproduce this error in activeadmin while using searching/filtering over text field(filter :question, filters: [:cont])
undefined method `table_name' for #<Arel::Table:...
0
votes
1
answer
381
views
Paper_trail gem stopped working when upgraded ransack to 4.0.0
In my rails 7.0.4 app I use:
activeadmin 3.0.0
ransack 4.0.0
paper_trail 15.0.0
I have the page for filtering and sorting history of changes to the data:
ActiveAdmin.register PaperTrail::Version do
...
1
vote
1
answer
367
views
Rails 7 + Active Admin: Filtering using comma-separated values
rails 7.0.4
activeadmin 2.12.13
I have an admin page for the model Product. A Product contains a field product_number.
I have the following code in admin/products.rb:
filter :product_number_equals, ...
0
votes
1
answer
243
views
ActiveAdmin filter via activerecord association
In a rails project I have two models:
# id
# email
# password
class User < ApplicationRecord
has_many :guests, dependent: :destroy
end
# id
# name
class Guest < ApplicationRecord
belongs_to ...
0
votes
1
answer
634
views
ActiveAdmin filter boolean with Nil Value
I use my Rails app to see if guests will participate to an event.
I have a Guest model that has a participate boolean.
This boolean is initialised as Nil for all new Guests. By initialising it in this ...
0
votes
0
answers
741
views
Using ransackable_attributes with Active Admin errors
We have a Rails 6.1 app with activeadmin 2.9.0 and ransack 2.4.2 and when we visit
/admin/users we get the following error:
ArgumentError in Admin::Users#index
Polymorphic associations do not support ...
0
votes
1
answer
425
views
Rails 6 ransacker to filter through User's polymorphic association
I'm trying to create a filter inside of Active Admin Conversation file, which will show me the User by his full name (user full name = user.first_name + user.last_name). User and Conversation are ...
1
vote
1
answer
1k
views
Active Admin filter params passed to ransacker
I am trying to pass a couple IDs through to a custom ransacker filter for active admin
filter :hasnt_purchased_product_items_in, as: :select, collection: -> { ProductItem.all }, multiple: true
...
2
votes
1
answer
1k
views
Ransack: Undefined method name in filter active admin
I am having a problem with active admin filter. I am getting the following issue,
undefined method `affiliate_link_of_affiliate_id_eq' for #<Ransack::Search:0x00007f80ef1078f0>
and i have used ...
0
votes
2
answers
2k
views
Use ActiveRecord scope in ActiveAdmin filter -- only apply the filter if checked
I have an ActiveRecord class Foo and I have an ActiveAdmin index view listing all my foos.
Foo has a scope called bland and my UI requirement is that I have a checkbox in the Filters section so that ...
1
vote
1
answer
691
views
Active Admin Search Status / Current Filters panel not using filter label
I have an active admin filter using ransack:
filter :address_state_or_address_city_cont, as: :string, label: "Address"
The problem in the Search Status panel is it's not using the label:
Saying '...
0
votes
1
answer
255
views
ActiveAdmin use custom method to filter data and match data present in the parent table column
I have bookings table which belongs to user and in my activeadmin booking resource I am displaying user by bookings.user.email and added the users filter as
filter :user_email, as: :string
But I ...
1
vote
5
answers
998
views
Can't use cont_any for multiterm search with Ransack (Rails 5)?
I'm using Ransack for search, which is working fine. But I would like the user to be able to search for multiple keywords in the same search input field.
For example if I have blog "I live in Ohio", ...
0
votes
1
answer
738
views
Active Admin with custom filter on a non-table attribute
collection: users
attributes: name, phone_no, email
ActiveAdmin.register User do
filter 'period', as: :date_range, label: 'From - To'
end
Above code works well for a date range
HOWEVER, Below ...
0
votes
1
answer
138
views
Rails ActiveAdmin custom filter
I have 3 models : User, Report and Invoices.
class User < ApplicationRecord
has_many :reports , :dependent => :destroy
has_many :invoices, :through => :reports
class Report < ...
2
votes
4
answers
2k
views
undefined method beginning_of_day for string with ransacker custom filter
I'm getting below mentioned error. any idea how i can fix it ?
undefined method `beginning_of_day' for "2018-01-01":String
/lib/ransack_ext.rb
config.add_predicate old, arel_predicate: current
end
...
0
votes
1
answer
684
views
Numeric custom filter with ransacker is not working
I am trying to make a new custom filter in ActiveAdmin of a rails application. When I put bellow code
filter :premium_scenes_in
it displays a input field as text input field (with option "contains", ...
1
vote
1
answer
2k
views
Custom ActiveAdmin Filter for Date Range - Complex Logic in Method
I am trying to create a custom ActiveAdmin filter that takes date_range as a parameter. Every solution I've found has been for excessively simple model methods.
Is there a way to pass both ...
2
votes
1
answer
485
views
Filter by multiple hstore keys in active admin
I'm trying to add a custom filter field for an hstore field.
In activeadmin: filter :by_title, label: 'Title', as: :string
In model :
ransacker :by_title do |parent|
Arel::Nodes::InfixOperation....
0
votes
1
answer
687
views
How to add filter by calculated value to activeadmin?
I have accounts that can be in block.
account.rb
has_many :blocks
block.rb
belongs_to :account
Block model has fields blocked_at and unblocked_at. I need to filter accounts that are (were) in ...
2
votes
0
answers
142
views
Ransack not to filter issue
I have a filter in ActiveAdmin resource page:
filter :active_in, label: 'Active', as: :select, collection: ['All', 'Yes', 'No']
and ransacker for it:
ransacker :active, formatter: proc {|value|
...
5
votes
1
answer
1k
views
Ransacker and Arel on associations fields
I have Project::Contribution that belongs_to User, and
User has_one User::Profile.
first_name and last_name are fields contained in User::Profile
I want to create a ransacker that would allow me to ...
1
vote
0
answers
704
views
How to fix Ransack undefined method “_eq”, when using ActiveAdmin
NoMethodError in Admin::Transacoes#index
Showing /usr/local/rvm/gems/ruby-2.3.0/bundler/gems/activeadmin-0ac35b7ff052/app/views/active_admin/resource/index.html.arb where line #2 raised:
undefined ...
2
votes
0
answers
3k
views
Custom filter in rails ActiveAdmin using ransack
I have created an activeadmin filter that has the following choices on filtering the table data in its drop-down menu.
Choice A
Choice B
Choice C
Choice D
I want to add a fifth choice F that ...
0
votes
1
answer
2k
views
undefined method `all' for Ransack::Search<class: Post, base: Grouping <combinator: and>>:Ransack::Search
I'm new in ruby and rails, I want to ask a question.
I'm getting error:
undefined method `all' for Ransack::Search<class: Post, base: Grouping <combinator: and>>:Ransack::Search
The ...
0
votes
0
answers
325
views
filter on child model attribute in the parent model #activeadmin #json field
I have 2 models, say, User and UserProfile. User has one UserProfile. The UserProfile has a json column named 'details' with 'age' as one of the keys. I need a filter in the User index page with ...
1
vote
0
answers
575
views
How do I create a custom ActiveAdmin filter?
I tried creating a custom filter using ActiveAdmin with Ransack in Rails 4, like this:
Create a ransacker in the User class.
ransacker :by_group, formatter: proc { |v|
data = User.with_role(v)....
2
votes
2
answers
913
views
Ransack + FlagShihTzu + Active Admin don't play well together
I'm using the brilliant gem flag_shih_tzu to create bitwise boolean flags on a single integer column without requiring a separate DB column for each flag. I have loved this gem for many years now, ...
2
votes
1
answer
3k
views
Custom ActiveAdmin filters
I'm using ActiveAdmin and I'm trying to implement my own filters.
Filter by day/week/month
Filter by price (virtual attribute), greater than and less than
businesses.rb
filter :period_eq, as: :...
0
votes
0
answers
2k
views
Using Ransack to generate custom Active Admin Filter
I am looking to create a custom filter that will search other tables data based on the associations I have set up, I have achieved this within my view but cannot transfer this to a custom filter with ...
1
vote
1
answer
315
views
Ruby on Rails using active_admin and ransack, paging error on a active_admin:resource
The error:
Collection is not a paginated scope. Set collection.page(params[:page]).per(10) before calling :paginated_collection.
unless collection.respond_to?(:num_pages)
raise(...
2
votes
2
answers
2k
views
Adding Numeric Range Filtering to ActiveAdmin
Greetings and Happy Holidays 2015 --
I tried to add numeric range filtering per the excellent blog post by Boris Stall.
I'm running:
Rails 4.2.4
Ruby 2.2.3
ActiveAdmin 1.0.0pre2
I keep running ...
1
vote
1
answer
569
views
Date filtering is not working on Rails - Ransack, Activeadmin
My application uses Rails, Activeadmin and Ransack.
Recently I've noticed that the date filtering is not working correctly. I've also checked on controllers separate from Activeadmin and the problem ...
10
votes
3
answers
5k
views
Activeadmin: how to filter for strings that match two or more search terms
Let's say I've got User class with an :email field. And let's say I'm using activeadmin to manage Users.
Making a filter that returns emails that match one string, e.g. "smith", is very simple. In ...
1
vote
0
answers
867
views
Rails. Active Admin filter, based on model method
I want to create Active Admin filter that is using my model's instance method.
My model's name is simply Item and this model has method used_in_widget?, that returns true / false of course.
Now, I ...
1
vote
2
answers
397
views
Custom filter in ActiveAdmin using 2 level array
Currently I have a Case model with the filter:
filter :specialty, as: :select, collection: Specialty.order(:category, :name)
The filter dropdown shows this:
category1 - name1
category1 - General
...
0
votes
2
answers
132
views
How can I create an ActiveAdmin filter that will show only objects without a value specified?
I am using the latest ActiveAdmin and I am trying to create a filter for a model that has a belongs_to relationship with another model, and therefor has a column litigation_canonical_docket_event_id ...
1
vote
2
answers
370
views
How can I use pg_search capabilities from ActiveAdmin filters?
I am using ActiveAdmin (the latest version) for an interface to my data. I am looking to implement some full-text search functionality and I'd like to try to use pg_search rather than SOLR or ...
0
votes
1
answer
501
views
activeadmin custom filter that contains 2 words on the same attribute
I am using Rails 4.2 with activeadmin 1.0.0.pre1 and postgresql 9.3.
My model attribute is a string.
Right now if I filter for "invoice 2011" it will give me results that contain "invoice 2011", ...
3
votes
0
answers
592
views
ActiveAdmin custom filter causes Ransack error
I have a ActiveAdmin column that I would like to filter by as a string. However when I enter this code on /app/admin/user.rb (the page where I would like the filter):
filter :name, as: :string
I ...
3
votes
0
answers
981
views
ActiveAdmin: Filter by count of child objects
In a Ruby on Rails app that heavily relies on ActiveAdmin, I have a Sponsor model, which is associated with a Sponsorship model. One sponsor can sponsor many children, so one sponsor can have many ...
6
votes
1
answer
2k
views
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
...
0
votes
1
answer
622
views
How to search for a substring in a custom filter in ActiveAdmin?
In the past:
A model User has a string filed first_name. If I write filter :first_name in ActiveAdmin model it would display a drop-down besides the input field with the options Contains, Equals, ...
2
votes
0
answers
564
views
Using a ransack filter to adjust join conditions
Consider this model:
Merchant:
id: int
name: string
Purchase:
id: int
merchant_id: int
created_at: datetime
Transactions:
id: int
purchase_id: int
amount: decimal
Then, I've got an ...
6
votes
1
answer
8k
views
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 ...