Hi
I am using simple_captcha. I have two models User and Staff.
Relation ship are
User has_one staff
staff belongs_to user
Now in the staff edit I have to include a captcha. I did like
<% form_for @user, :url => staff_url(@staff), :html => {:method =>
:put
} do |f|%>
<p>
<%= f.text_field :first_name,:maxlength => 50 %>
</p>
<p>
<%= show_simple_captcha :image_style =>
''random'',:distortion =>
''medium'' %>
</p>
<%end %>
And in staff.rb
apply_simple_captcha :message => "Verification code does not match with
image."
And in update action of of staff controller
def update
@staff = Staff.find(params[:id])
@user = @staff.user
if @staff.valid_with_captcha? and
@user.update_attributes(params[:user])
flash[:notice] = "check your mail "
redirect_to login_url
else
flash.now[:error] = @staff.errors.full_messages.join("<br
/>")
#This I wrote deliberately
render :action => :edit
end
end
But even I put the correct captcha code and submit , it always shows
message
"Verification code does not match with image.". Dont know why please
help
Note:
The params are like
{"user"=>{"first_name"=>"Tom",
"last_name"=>""},
"action"=>"update",
"_method"=>"put",
"authenticity_token"=>"0OWRFPssTgTqCUESex7LrJ2QQ7HWSiAQxtiMhQm/N1s=",
"captcha"=>"PYESEZ", "id"=>"10",
"controller"=>"staff"}
Thanks in advance
Tom
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.