Sha256: bb146ff99dcf73156d6e511f96845378532875d6aad75c194b7da4ec01e5b253

Contents?: true

Size: 454 Bytes

Versions: 1

Compression:

Stored size: 454 Bytes

Contents

module ClarkKent
	class UserReportEmail < ActiveRecord::Base
		belongs_to :user
		belongs_to :report_email

		attr_accessible :email, :report_email_id

	  validates_with UserEmailValidator

		def email=(address)
			self.user = User.where("lower(users.email) = lower(:email)",email: address).first
			self.errors.add(:email, "Couldn't find a user with that email addres") unless self.user.present?
		end

		def email
			self.user.try :email
		end
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
clark_kent-0.0.1 app/models/clark_kent/user_report_email.rb