Hi Experts,
l have model called User
class User < ActiveRecord::Base
apply_simple_captcha
end
in view
<%= show_simple_captcha(:object=>"user") %>
in controller
@user = User.fiind(params[:id])
if @user.valid_with_captcha?
if @user.update_attributes(params[:use])
--------
else
---------
end
else
--------------------
end
as per this code is working fine, but all the text which i''ve entered
in textfields are cleared, and shows error appropriate error like
first_name and last_name is blank but i feeded all the data correct
way except the captcha value, which shouldnt happen.
Plz help me guys, i''m stuck up with that
TIA,
Bala
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
First, it seems to me that a model is not where a captcha might want to go. I personally feel it should be in the controller and view, but not in the model. That said, I have a helper method (well, once I refactor it out into a method) which generates the captcha (for the view) and a simple function which validates it and returns either :success, :failure, or nil. :success means it matched. :failure means it did not. nil means it could not perform the check, either because it could not reach the servers or some internal error to my code. I treat this as :success and move on. --Michael --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---