Class: ClarkKent::UserReportEmail
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- ClarkKent::UserReportEmail
show all
- Includes:
- Cloneable
- Defined in:
- app/models/clark_kent/user_report_email.rb
Instance Method Summary
collapse
Methods included from Cloneable
#cloneable_attributes, #reset_timestamps
Instance Method Details
#email ⇒ Object
15
16
17
|
# File 'app/models/clark_kent/user_report_email.rb', line 15
def email
self.user.try :email
end
|
#email=(address) ⇒ Object
10
11
12
13
|
# File 'app/models/clark_kent/user_report_email.rb', line 10
def email=(address)
self.user = ClarkKent.user_class.where("lower(#{ClarkKent.user_class_name.underscore.pluralize.gsub(/\//,'')}.email) = lower(:email)",email: address).first
self.errors.add(:email, "Couldn't find a user with that email addres") unless self.user.present?
end
|