@@ -14,7 +14,11 @@ class Post < ApplicationRecord
1414 has_many :post_tags , inverse_of : :post , dependent : :destroy
1515 has_many :tags , through : :post_tags
1616
17- serialize :description , coder : JSON
17+ if Gem ::Version . new ( Rails . version ) >= Gem ::Version . new ( '7.1' )
18+ serialize :description , coder : JSON
19+ else
20+ serialize :description , JSON
21+ end
1822
1923 after_initialize -> { self . description = { } if description . nil? }
2024
@@ -50,13 +54,11 @@ def upper_title
5054 title . upcase
5155 end
5256
53- class << self
54- def ransackable_associations ( _auth_object = nil )
55- [ "author" , "author_profile" , "post_tags" , "tags" ]
56- end
57+ def self . ransackable_associations ( _auth_object = nil )
58+ [ "author" , "author_profile" , "post_tags" , "tags" ]
59+ end
5760
58- def ransackable_attributes ( _auth_object = nil )
59- [ "author_id" , "category" , "created_at" , "description" , "dt" , "id" , "position" , "published" , "title" , "updated_at" ]
60- end
61+ def self . ransackable_attributes ( _auth_object = nil )
62+ [ "author_id" , "category" , "created_at" , "description" , "dt" , "id" , "position" , "published" , "title" , "updated_at" ]
6163 end
6264end
0 commit comments