Hello,
I am trying to integrate a captcha into a form that is used to update a
database. I am using a method that is outlined here:
http://svn.2750flesk.com/validates_captcha/trunk/README, but things are
not
working correctly. The captcha image shows up in the user form, but the
captcha input is being ignored. The following shows my controller file:
class PublicController < ApplicationController
include ActionView::Helpers::TextHelper
verify :method => :post, :only => [ :destroy, :create, :update ],
:redirect_to => { :action => :index }
def index
@posts = Post.public_posts
end
def save
@supermodel = MySuperModel.find(params[:id])
@supermodel.attributes = params[:my_super_model]
@supermodel.save
end
def create
@post = Post.new(params[:post])
if @post.save
flash[:notice] = ‘Post was successfully created.’
redirect_to :action => ‘index’
else
render :action => ‘new’
end
end
def new
@post = Post.new
end
end
The plugin is in my vendor/plugins directory as well. Here is my view:
<%= start_form_tag(:action => “create”) %>
| Title: | <%= text_field("post", "title", "size" => 46 ) %> |
| Description: | <%= text_area("post", "description", "cols" => 40, "rows" => 10 ) %> |
| <% c = prepare_captcha -%> <%= captcha_hidden_field c, 'my_super_model' %> <%= captcha_image_tag c %> | |
|
<%= captcha_label 'my_super_model', 'Confirm Captcha ' %> <%= captcha_text_field 'my_super_model' %> |
|
| <%= submit_tag(" Submit ") %> |
Can anyone tell me what I am missing? I think that it is more that a
form
issue, since I am not getting errors about “wrong captcha” or anything
like
that.
Thanks