Skip to content

Commit a79ca95

Browse files
authored
Merge pull request #50 from tf/ransack-assoc
Define ransackable associations for test models
2 parents 814c9d4 + 29ea557 commit a79ca95

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

spec/support/models.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class Category < ActiveRecord::Base
88
def self.ransackable_attributes(_auth_object = nil)
99
['name']
1010
end
11+
12+
def self.ransackable_associations(_auth_object = nil)
13+
[]
14+
end
1115
end
1216

1317
class Post < ActiveRecord::Base
@@ -19,6 +23,10 @@ class Post < ActiveRecord::Base
1923
def self.ransackable_attributes(_auth_object = nil)
2024
%w(category_id title)
2125
end
26+
27+
def self.ransackable_associations(_auth_object = nil)
28+
[]
29+
end
2230
end
2331

2432
module RGB
@@ -36,6 +44,10 @@ class TagName < ActiveRecord::Base
3644
def self.ransackable_attributes(_auth_object = nil)
3745
['color_id']
3846
end
47+
48+
def self.ransackable_associations(_auth_object = nil)
49+
[]
50+
end
3951
end
4052
end
4153

@@ -47,6 +59,10 @@ class OptionValue < ActiveRecord::Base
4759
def self.ransackable_attributes(_auth_object = nil)
4860
['value']
4961
end
62+
63+
def self.ransackable_associations(_auth_object = nil)
64+
[]
65+
end
5066
end
5167

5268
class Product < ActiveRecord::Base

0 commit comments

Comments
 (0)