5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/hobo_devise.rb', line 5
def self.hobo_devise_user_model(opts={})
self.class_eval do
hobo_user_model
alias_attribute :email_address, :email
fields do
email :email_address, :login => true
end
end
opts.reverse_merge!({ :auth_methods => :database_authenticatable })
user_class = self
if opts[:auth_methods].is_a? Array
for auth_method in opts[:auth_methods]
HoboDevise.send(auth_method, user_class) if HoboDevise.methods.include? auth_method.to_s
end
else
auth_method = opts[:auth_methods]
HoboDevise.send(auth_method, user_class) if HoboDevise.methods.include? auth_method.to_s
end
end
|