Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

support mongoid aswell #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

support mongoid aswell #77

wants to merge 1 commit into from

Conversation

sbounmy
Copy link

@sbounmy sbounmy commented Feb 14, 2014

No description provided.

Copy link

@csroberson csroberson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, this would be a reasonable addition to address the Mongo issue. I will be trying this on my local system.

@@ -1,5 +1,5 @@
#require 'rails/all'
require 'active_record/connection_adapters/abstract/schema_definitions'
require 'active_record/connection_adapters/abstract/schema_definitions' if defined?(ActiveRecord)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@@ -80,6 +80,8 @@ module Controllers
end
end

orm = defined?(Mongoid) ? 'mongoid' : 'active_record'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

require 'devise_security_extension/models/old_password'
require 'devise_security_extension/models/security_question'
require 'devise_security_extension/orm/active_record' if defined?(ActiveRecord)
require "devise_security_extension/models/#{orm}/old_password"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this approach to addressing the issue with OldPassword and Mongoid.


belongs_to :password_archivable, :polymorphic => true
attr_accessible :encrypted_password
end
Copy link

@csroberson csroberson Nov 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment on this model (and I'm not a Ruby on Rails expert, so take it with a grain of salt but) wouldn't defining belongs_to :password_archivable, :polymorphic automatically created the password_archivable_id and password_archivable_type fields?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants