I’ve got the following I’ve pasted into my user model:
module ClassMethods
Devise::Models.config(self, :email_regexp, :password_length)
end
I want to do something like self.extend ClassMethods in my User model, but I can’t quite seem to get it right. I want to make these methods from devise accessible directly in my User model.
You need to use
ActiveSupport::Concernfor this. In the module that should be used to extend a class you insert:And then eht only thing you need to do is
includeit in theModelyou want to extend!Thats it. For more info have a look at apidock => ActiveSupport::Concern!