From 20c2700ed3706ff840e60f303a913bc15540bf05 Mon Sep 17 00:00:00 2001 From: madhums Date: Tue, 2 Jan 2024 20:42:54 +0100 Subject: [PATCH] update mobility-ransack to 1.2.2 (ransack 4.1.1) --- Gemfile | 2 +- Gemfile.lock | 12 ++++++------ app/models/story.rb | 8 ++++++++ app/models/story_update.rb | 4 ++++ 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index f6fd723b..347da00b 100644 --- a/Gemfile +++ b/Gemfile @@ -39,7 +39,7 @@ gem "administrate", "~> 0.18.0" # Translatable content gem "mobility", "~> 1.2" -gem "mobility-ransack", "~> 1.2" +gem "mobility-ransack", "~> 1.2.2" # Soft deletions gem "discard", "~> 1.2" diff --git a/Gemfile.lock b/Gemfile.lock index 3fd0d459..785db8fc 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -220,9 +220,9 @@ GEM mobility (1.2.9) i18n (>= 0.6.10, < 2) request_store (~> 1.0) - mobility-ransack (1.2.1) + mobility-ransack (1.2.2) mobility (>= 1.0.1, < 2.0) - ransack (>= 1.8.0, < 3.2) + ransack (>= 1.8.0, < 5.0) msgpack (1.6.0) nenv (0.3.0) net-imap (0.3.1) @@ -292,9 +292,9 @@ GEM zeitwerk (~> 2.5) rainbow (3.1.1) rake (13.0.6) - ransack (3.1.0) - activerecord (>= 6.0.4) - activesupport (>= 6.0.4) + ransack (4.1.1) + activerecord (>= 6.1.5) + activesupport (>= 6.1.5) i18n rb-fsevent (0.11.2) rb-inotify (0.10.1) @@ -451,7 +451,7 @@ DEPENDENCIES jsbundling-rails (~> 1.0) kaminari (~> 1.2) mobility (~> 1.2) - mobility-ransack (~> 1.2) + mobility-ransack (~> 1.2.2) pg (~> 1.1) puma (~> 5.6) pundit (~> 2.2) diff --git a/app/models/story.rb b/app/models/story.rb index ca199eec..c9d57c79 100644 --- a/app/models/story.rb +++ b/app/models/story.rb @@ -30,6 +30,14 @@ class Story < ApplicationRecord discussions.undiscard_all end + def self.ransackable_attributes(auth_object = nil) + %w[title, description, outcomes, source, country] + end + + def self.ransackable_associations(auth_object = nil) + %w[story_updates] + end + # https://github.com/countries/country_select#getting-the-country-name-from-the-countries-gem # Assuming country_select is used with User attribute `country` # This will attempt to translate the country name and use the default diff --git a/app/models/story_update.rb b/app/models/story_update.rb index 1c11e5a8..75d067a0 100644 --- a/app/models/story_update.rb +++ b/app/models/story_update.rb @@ -9,4 +9,8 @@ class StoryUpdate < ApplicationRecord validates :title, :description, presence: true translates :title, :description + + def self.ransackable_attributes(auth_object = nil) + %w[title description] + end end