Module: MailForm::Delivery
Defined Under Namespace
Modules: ClassMethods, Deprecated
Instance Method Summary collapse
-
#deliver! ⇒ Object
Deliver the resource without checking any condition.
- #not_spam? ⇒ Boolean
-
#spam? ⇒ Boolean
In development, raises an error if the captcha field is not blank.
Instance Method Details
#deliver! ⇒ Object
Deliver the resource without checking any condition.
173 174 175 |
# File 'lib/mail_form/delivery.rb', line 173 def deliver! MailForm::Notifier.contact(self).deliver end |
#not_spam? ⇒ Boolean
168 169 170 |
# File 'lib/mail_form/delivery.rb', line 168 def not_spam? !spam? end |
#spam? ⇒ Boolean
In development, raises an error if the captcha field is not blank. This is is good to remember that the field should be hidden with CSS and shown only to robots.
In test and in production, it returns true if all captcha fields are blank, returns false otherwise.
154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/mail_form/delivery.rb', line 154 def spam? self.class.mail_captcha.each do |field| next if send(field).blank? if defined?(Rails) && Rails.env.development? raise ScriptError, "The captcha field #{field} was supposed to be blank" else return true end end false end |