Sha256: fd4f6702112216c9d79a88d41c640395096bd0fc08a95584cc9739d19d92a582
Contents?: true
Size: 862 Bytes
Versions: 5
Compression:
Stored size: 862 Bytes
Contents
class FeedbackController < ApplicationController # http://expressica.com/simple_captcha/ # include SimpleCaptcha::ControllerHelpers # show the feedback form def show @errors=[] if request.post? if validate Notifier.feedback(params) redirect_to feedback_complete_path end end end protected # validates the incoming params # returns either an empty array or an array with error messages def validate unless params[:name] =~ /\w+/ @errors << 'A valid name is required' end unless params[:email] =~ /\w+@\w+\.\w+/ @errors << 'A valid email address is required' end unless params[:message] =~ /\w+/ @errors << 'A message is required' end #unless simple_captcha_valid? # @errors << 'Captcha did not match' #end @errors.empty? end end
Version data entries
5 entries across 5 versions & 1 rubygems