Skip to content

Commit 51f45c4

Browse files
alexplatteeuwtf
authored andcommitted
Add support for Active Admin 3.0
1 parent c42cb24 commit 51f45c4

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

activeadmin-searchable_select.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
3535
spec.add_development_dependency 'semmy', '~> 1.0'
3636
spec.add_development_dependency 'sprockets', '~> 3.7'
3737

38-
spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 3']
38+
spec.add_runtime_dependency 'activeadmin', ['>= 1.x', '< 4']
3939
spec.add_runtime_dependency 'jquery-rails', ['>= 3.0', '< 5']
4040
spec.add_runtime_dependency 'select2-rails', '~> 4.0'
4141
end

spec/support/models.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ class User < ActiveRecord::Base; end
44

55
class Category < ActiveRecord::Base
66
belongs_to :created_by, class_name: 'User'
7+
8+
def self.ransackable_attributes(_auth_object = nil)
9+
['name']
10+
end
711
end
812

913
class Post < ActiveRecord::Base
1014
belongs_to :category
1115
belongs_to :user
1216

1317
scope(:published, -> { where(published: true) })
18+
19+
def self.ransackable_attributes(_auth_object = nil)
20+
%w(category_id title)
21+
end
1422
end
1523

1624
module RGB
@@ -24,13 +32,21 @@ module Internal
2432
class TagName < ActiveRecord::Base
2533
self.table_name = :internal_tag_names
2634
belongs_to :color, class_name: 'RGB::Color', foreign_key: :color_id
35+
36+
def self.ransackable_attributes(_auth_object = nil)
37+
['color_id']
38+
end
2739
end
2840
end
2941

3042
class OptionType < ActiveRecord::Base; end
3143

3244
class OptionValue < ActiveRecord::Base
3345
belongs_to :option_type
46+
47+
def self.ransackable_attributes(_auth_object = nil)
48+
['value']
49+
end
3450
end
3551

3652
class Product < ActiveRecord::Base

0 commit comments

Comments
 (0)