18 lines
445 B
Ruby
18 lines
445 B
Ruby
|
|
module JamRuby
|
||
|
|
class Feedback
|
||
|
|
include ActiveModel::Validations
|
||
|
|
include ActiveModel::Validations::Callbacks
|
||
|
|
include ActiveModel::Observing
|
||
|
|
extend ActiveModel::Callbacks
|
||
|
|
|
||
|
|
VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i
|
||
|
|
validates :email, presence: true, format: {with: VALID_EMAIL_REGEX}
|
||
|
|
validates :body, :presence => true
|
||
|
|
|
||
|
|
attr_accessor :email, :body
|
||
|
|
|
||
|
|
def save
|
||
|
|
return valid?
|
||
|
|
end
|
||
|
|
end
|
||
|
|
end
|