Sha256: ac7fad2c3fb14d2cd5eccb63e4d80aa81ca72ef062b257c9007436fde1cc85fa
Contents?: true
Size: 889 Bytes
Versions: 17
Compression:
Stored size: 889 Bytes
Contents
# -*- encoding : utf-8 -*- 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
17 entries across 17 versions & 1 rubygems