Skip to content

Commit

Permalink
Merge pull request #327 from eugeneius/lazy_load_hook
Browse files Browse the repository at this point in the history
Use a lazy load hook to configure Active Record
  • Loading branch information
saghaulor authored Nov 13, 2018
2 parents ee82b3b + 333775b commit 3ea0c45
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/attr_encrypted/adapters/active_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ def method_missing_with_attr_encrypted(method, *args, &block)
end
end

ActiveRecord::Base.extend AttrEncrypted
ActiveRecord::Base.extend AttrEncrypted::Adapters::ActiveRecord
ActiveSupport.on_load(:active_record) do
extend AttrEncrypted
extend AttrEncrypted::Adapters::ActiveRecord
end
end

0 comments on commit 3ea0c45

Please sign in to comment.