Move back from after_initialize to explicit call (#11881)
This commit is contained in:
parent
1e0c53811d
commit
09fc23fd56
2 changed files with 4 additions and 5 deletions
|
|
@ -25,8 +25,6 @@ class Profile < ApplicationRecord
|
|||
}.with_indifferent_access.freeze
|
||||
|
||||
# Generates typed accessors for all currently defined profile fields.
|
||||
# This is also used in config/application.rb to initialize profiles on app
|
||||
# boot in the after_initialize hook.
|
||||
def self.refresh_attributes!
|
||||
return if ENV["ENV_AVAILABLE"] == "false"
|
||||
return unless Database.table_exists?("profiles")
|
||||
|
|
@ -36,6 +34,10 @@ class Profile < ApplicationRecord
|
|||
end
|
||||
end
|
||||
|
||||
# Set up all profile attributes when this class loads so all store_attribute
|
||||
# accessors get defined immediately.
|
||||
refresh_attributes!
|
||||
|
||||
# Returns an array of all currently defined `store_attribute`s on `data`.
|
||||
def self.attributes
|
||||
(stored_attributes[:data] || []).map(&:to_s)
|
||||
|
|
|
|||
|
|
@ -81,9 +81,6 @@ module PracticalDeveloper
|
|||
top_routes << route
|
||||
end
|
||||
ReservedWords.all = [ReservedWords::BASE_WORDS + top_routes].flatten.compact.uniq
|
||||
|
||||
# Set up all profile attributes when the app starts
|
||||
Profile.refresh_attributes!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue