BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
35729671
Commit
35729671
authored
May 15, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'attr_encryped_no_db_connection' into 'master'
Don't require DB connection in AttrEncrypted. See merge request !667
parents
25b09688
61ceb450
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
0 deletions
+20
-0
attr_encrypted_no_db_connection.rb
config/initializers/attr_encrypted_no_db_connection.rb
+20
-0
No files found.
config/initializers/attr_encrypted_no_db_connection.rb
0 → 100644
View file @
35729671
module
AttrEncrypted
module
Adapters
module
ActiveRecord
def
attribute_instance_methods_as_symbols_with_no_db_connection
# Use with_connection so the connection doesn't stay pinned to the thread.
connected
=
::
ActiveRecord
::
Base
.
connection_pool
.
with_connection
(
&
:active?
)
rescue
false
if
connected
# Call version from AttrEncrypted::Adapters::ActiveRecord
attribute_instance_methods_as_symbols_without_no_db_connection
else
# Call version from AttrEncrypted, i.e., `super` with regards to AttrEncrypted::Adapters::ActiveRecord
AttrEncrypted
.
instance_method
(
:attribute_instance_methods_as_symbols
).
bind
(
self
).
call
end
end
alias_method_chain
:attribute_instance_methods_as_symbols
,
:no_db_connection
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment