e x p r e s s i c a

ruby on rails, business and technicalities

No public Twitter messages.

  • RSS
  • Facebook
  • Twitter
  • Linkedin


Recommend Me

If this plug-in helped you then please recommend me here.


Version: edge (SVN Revision 31)
Author: Sur
Company: Crimson9
Contributors: Kei Kusakari, nap
License: MIT

Introduction:
SimpleCaptcha is the simplest and a robust captcha plugin. Its implementation requires adding up a single line in views and in controllers/models.
SimpleCaptcha is available to be used with Rails2.0 or above and also it provides the backward compatibility with previous versions of Rails.

Features:

  • Zero FileSystem usage(secret code moved to db-store and image storage removed).
  • Provides various image styles.
  • Provides three level of complexity of images.
  • Works absolutely fine in distributed environment
  • Implementation is as easy as just writing a single line in your view…
    “<%= show_simple_captcha %>” within the ‘form’ tags.
  • Flexible DOM and CSS handling(There is a separate view partial for rednering SimpleCaptcha DOM elements).
  • Automated removal of 1 hour old unmatched simple_captcha data.
  • Option to create alphabetic or numeric Images.

Pre-Requisite

RMagick should be installed on your machine to use this plugin.
visit http://rmagick.rubyforge.org for more details.

Installation

Repository

SimpleCaptcha plugin can be installed by running this command from the application root

ruby script/plugin install svn://rubyforge.org/var/svn/expressica/plugins/simple_captcha

OR

Download

If you are unable to checkout/install the plugin via SVN. Download the archive and unzip it into /vendor/plugins directory of the rails-app.

Setup

After installation, follow these simple steps to setup the plugin. The plugin’s configuration will highly depend on the version of rails your application is using, so be specific in the following steps.

STEP 1

for rails >= 2.0

rake simple_captcha:setup

for rails < 2.0

rake simple_captcha:setup_old

STEP 2

rake db:migrate

STEP 3

add the following code in the file config/routes.rb

ActionController::Routing::Routes.draw do |map|
  map.simple_captcha '/simple_captcha/:action', :controller => 'simple_captcha'
end

This is a mandatory route used for rendering the simple_captcha image on the fly without storing on the filesystem.

STEP 4

add the following line in the file app/controllers/application.rb

ApplicationController < ActionController::Base
  include SimpleCaptcha::ControllerHelpers
end

NOTE:
Apart from above setting up steps…

If your controller(the one through which you are implementing captcha) is not inherited from ApplicationController, it is required to add the line “include SimpleCaptcha::ControllerHelpers” in it.

Usage

Controller Based

In the view file within the form tags add this code

<%= show_simple_captcha %>

and in the controller’s action authenticate it as

def my_action
  if simple_captcha_valid?
    do_this
  else
    do_that
  end
end

Model Based

In the view file within the form tags write this code

<%= show_simple_captcha(:object=>"user") %>

and in the model class add this code

class User < ActiveRecord::Basse
  apply_simple_captcha
end

Validating with captcha

@user.valid_with_captcha?

NOTE: @user.valid? will still work as it should, it will not validate the captcha code.

Saving with captcha

@user.save_with_captcha

NOTE: @user.save will still work as it should, it will not validate the captcha code.

Options & Examples

View Options

:label
provides the custom below the image, default is “(type the code from the image)”

:image_style
Provides the specific image style for the captcha image.
There are eight different styles available with the plugin as…

  • simply_blue
  • simply_red
  • simply_green
  • embosed_silver
  • all_black
  • distorted_black
  • charcoal_grey
  • almost_invisible

Default is ‘simply_blye’
You can also specify ‘random’ to select the random image style.

:distortion
Handles the complexity of the image. The :distortion can be set to ‘low’, ‘medium’
or ‘high’. Default is ‘low’.

:code_type
Handles the text of the captcha image. Available options are ‘numeric’ or ‘alphabetic’.
Default is ‘alphabetic’.

:o bject
the name of the object of the model class, to implement the model based captcha.

How to change the CSS for SimpleCaptcha DOM elements ?
You can change the CSS of the SimpleCaptcha DOM elements as per your need in this file…
For Rails >= 2.0 the partial view file wiil reside as…
“/app/views/simple_captcha/_simple_captcha.erb”
For Rails < 2.0 the partial view file will reside as…
“/app/views/simple_captcha/_simple_captcha.rhtml”

View’s Examples

simple_captcha

Controller Based Example
example

<%= show_simple_captcha(:label => "(human authentication)") %>

example

<%= show_simple_captcha(:image_style => 'embosed_silver', :distortion => 'medium') %>

example

<%= show_simple_captcha(:image_style => 'random', :label => "(are you human ?)") %>

Model Based Example

example

<%= show_simple_captcha(:object => 'user', :image_style => 'simply_red', :distortion => 'medium') %>

Model Options

:message
provides the custom message on failure of captcha authentication
the default is “image did not match with text”

:add_to_base
if set to true, adds the error message to the base.

Model’s Example

example

class User < ActiveRecord::Base
  apply_simple_captcha
end

example

class User < ActiveRecord::Base
  apply_simple_captcha :message => " image and text were different", :add_to_base => true
end

Any feedback/comment/issue/donation is welcome!
Drop me a mail at sur(DOT)max(AT)gmail(DOT)com

If you like this plugin, do not forget to Recommend Me.


87 Responses so far.

  1. oli says:

    thanks for your great work.. but it looks like there’s a bug

    i have 5 migrations in my db/migrate/ dir:
    005_create_chemicals.rb 008_create_dangerclasses.rb 010_create_units.rb 012_create_categories.rb 014_hersteller.rb
    007_create_orders.rb 009_create_deliver_adresses.rb 011_create_prices.rb 013_create_users.rb

    after i run rake simple_captcha:setup i have those files:
    005_create_chemicals.rb 008_create_dangerclasses.rb 010_create_units.rb 012_create_categories.rb 014_hersteller.rb
    007_create_orders.rb 009_create_deliver_adresses.rb 011_create_prices.rb 013_create_users.rb 015_create_simple_captcha_data.rb

    when i try to run rake db:migrate i received an error in 014_hersteller.rb, so i looked at this file… and this is whats in the file:
    # Copyright (c) 2007 [Sur http://expressica.com

    class CreateSimpleCaptchaData 40
    t.string :value, :limit => 6
    t.timestamps
    end
    end

    def self.down
    drop_table :simple_captcha_data
    end
    end

    it looks like your simple_captcha overwrites the last migration in the dir

  2. oli says:

    no, there are not 5 migrations, there are 9 *g*
    after the rake simple_captcha:setup there are 10
    but i think there should be 11?

  3. sur says:

    Hi Oli,

    Thanks for pointing that out.
    I’ve fixed the bug and updated the SVN repository. You can check out the latest code and try it now.
    Now it will specifically look for the added migration with the name “create_simple_captcha_data.rb” but not the last file.

    Thanks.

  4. PJ says:

    Hi

    I get this error when i try to load my form:

    “A copy of AuthenticatedSystem has been removed from the module tree but is still active!”

    I have RESTful Authentication installed…

    ???

    PJ.

  5. sur says:

    PJ,

    How does that related to Simple Captcha ?

  6. Zigmond says:

    In Rails 1.2.6, when I run rake simple_cpatcha:setup it gives this error message:

    uninitialized constant Rails::Initializer::RAILS_GEM_VERSION

    How can I fix this?

  7. sur says:

    Hi Zigmond,

    That might be the problem in the environment.rb i.e. RAILS_GEM_VERSION = ‘X.X.X’ might be commented out.
    But again as this can be the case for others as well… I have changed the way to setup the plugin, making it more generic and independent of the platform(Linux, Mac and Windows) as well. Because on Windows, I noticed that the command “rake db:migrate” is not responding from a ruby program.

    I’ve updated the post showing how to setup the plugin for different versions of rails. Have a look to the section “Setup” in the post above, this will solve your issue.

    Thanks.

  8. PJ says:

    sur,

    …when i installed Simple_Captcha and put in the form view page and modified the controller action accordingly (as per the instructions on your website and in the readme file) – that is the error that i get! :

    “A copy of AuthenticatedSystem has been removed from the module tree but is still active!”

    The funny thing is that even when i removed the changes i made, i kept on getting that error in other places in my website relating to logging in / editing / submitting forms etc…

    So, it appeared that the plugin had changed something. Only when i unsinstalled Simple_Captcha did everything get back to normal….

    I am using rails 1.2.5…

    PJ.

  9. Stephan Wehner says:

    If a site uses its own images, gather a few CAPTCHA examples until all letters have been shown, save all the image files referenced, make a list of their letters, and then happily pass any test in an automated fashion?

    Or is there more to this CAPTCHA implementation?

    Thanks!

    Stephan

  10. sur says:

    UPDATE
    The plugin has been updated to provide the eight different styles of images by usging RMagick.

  11. Kengi says:

    Thanks, I want to know how to refresh the code image via a ajax “click”.

    $(“simple_captcha_image”).innerHTML=”";

  12. sur says:

    Hi Kengi,

    Its a feature in a queue for the release of version 2.0

  13. kai says:

    RMagick still required?

    According to the title at http://expressica.com/2007/03/23/simple_captcha_1_0/

    “No Pre-Requisites
    RMagick Removed
    FileSystem Usage Removed
    Works Perfectly with Multiple Clustered Servers”

    I am confused.

  14. smooth says:

    I had the same problem as PJ, above:

    Sometimes I get the error:

    “A copy of AuthenticatedSystem has been removed from the module tree but is still active!”

    when loading any page on my site that requires authentication. I started getting this error immediately after I installed simple_captcha. I solved it by modifying the bottom of simple_captcha_action_controller.rb like so:

    ApplicationController.module_eval do
    include SimpleCaptcha::ControllerHelpers
    unloadable
    end

    Works for me. I am using Rails 1.2.6 and RESTful authentication.

  15. sur says:

    Hi Smooth,

    Thanks for pointing that out.

    Though I am not facing this problem, PJ if you can try this with the latest code and if it will solve your problem, I can add that in the repository.

    Thanks!

  16. Michael says:

    Hi Sur Max,

    Thanks for the plugin.
    The plugin works in the single shot!!

    I haven’t seen simpler implementation of the captcha anywhere else.

  17. James says:

    Hi Sur,

    If you say No RMagick dependency, why do you mention in the Pre-Requisites that RMagick must be installed. I have uninstalled RMagick and I’m using MiniMagick coz RMagick eats into my memory and I’m not going to have tat ruin my production servers.
    This is from one of your comments earlier:

    “sur said: On 12/21/2007 at 7:10 pm
    Update: SimpleCaptcha 1.2.0 is up!!

    Major Changes…
    No Pre-Requisites
    RMagick Removed
    FileSystem Usage Removed
    Works Perfectly with Multiple Clustered Servers”

  18. James says:

    Just read your comments put on Jan 7th on why you had to put back the RMagick plugin, I would like to know if I would be able to use this plugin using MiniMagick and if so, what changed would I have to do.

    Thanks,

  19. PJ says:

    smooth, thanks for the tip, i will try that and see if it works….

    will post back.
    :)

    PJ.

  20. sur says:

    @James
    I haven’t tried the MiniMagick, If you can explore that and make a generic change to switch between the RMagick & MiniMagick while setting up the plugin.. I would be able to incorporate that in the plugin.

    @PJ
    Please mind it to pick the latest code from the repository before trying that out. It uses RMagick and provides various image styles.

  21. torsten says:

    Very nice, worked out of the box! Thanks (Rails 2.0.2, Debian/Lenny)

  22. Hamza says:

    Hi,

    I am having a problem using the new version of the plugin. I am running Rails 1.1.6. I am also using Engines , specifically the User, Login, and Roles engines.

    When I install the plugin and try and start the server I get this error :

    script/server
    => Booting WEBrick…
    ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:100:in `const_missing’: uninitialized constant UserEngine (NameError)
    from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:131:in `const_missing’
    from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:133:in `send’
    from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:133:in `const_missing’
    from ./script/../config/../app/controllers/application.rb:11
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require’
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require’
    from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require’
    from ./script/../config/../vendor/plugins/simple_captcha/lib/simple_captcha_action_controller.rb:3
    … 20 levels…
    from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require’
    from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:30
    from script/server:3:in `require’
    from script/server:3

    The two lines it is complaining on are :

    1) require ‘application’ in simple_captcha_action_controller
    2) include UserEngine in my application.rb file

    Does anyone have any pointers to how I can fix this ?

    Thanks.

    Hamza

  23. anurag says:

    simple captcha is not working IMGAGE CODE AND ENTERED KEYS ARE NOT EQUAL. I HAVE FOLLOW STEPS AS SHOWN IN THE WEBSITE, IT SHOWING THE ERROR IMGAE AND TEXT WERE DIFFERENT.

  24. sur says:

    @Hamza
    Thats might be because Engine has not been loaded before the plugin. Anyhow, I have removed the line require ‘application’ from the code and made it the other way to use the ApplicationController and updated the repositroy. You can re-checkout the plugin!

    @anurag
    The message simply shows you are entering the wrong characters!

  25. Stephane says:

    Hi,

    I had the same problem of PJ “A copy of AuthenticatedSystem has been removed from the module tree but is still active!” so i modified the file “simple_captcha_action_controller.rb” with this

    “ApplicationController.module_eval do
    include SimpleCaptcha::ControllerHelpers
    #added this line
    unloadable
    end

    That fixed the problem but now i’m getting:

    “NoMethodError (undefined method `simple_captcha_valid?’ for #):

    Any idea?

    Thanks for you help,

    Stephane

  26. jjb says:

    I was getting the error “A copy of ApplicationHelper has been removed from the module tree but is still active” after installing 1.2.2 of this plugin. I was able to eliminate it by having simple_capcha refer to ActiveController::Base instead of ApplicationController. Don’t know if that’s a good approach but it seems like it’s working for us. Here’s the change:

    jjb@Macintosh:~/eng/svn/ic/trunk:0>svn diff vendor/plugins/simple_captcha/
    Index: vendor/plugins/simple_captcha/lib/simple_captcha_controller.rb
    ===================================================================
    — vendor/plugins/simple_captcha/lib/simple_captcha_controller.rb (revision 711)
    +++ vendor/plugins/simple_captcha/lib/simple_captcha_controller.rb (working copy)
    @@ -1,6 +1,6 @@
    # Copyright (c) 2008 [Sur http://expressica.com

    -class SimpleCaptchaController

  27. sur says:

    @jjb

    Yeah, that will work but, the problem is that it will not be compatible with all older rails versions and I am trying to make it as generic as possible to be used from 1.1.6 to all the latest ones.

    I have just updated the repository with the SVN revision 24 with fixing this issue also keeping the support for previous versions of rails, also a small new feature is added — the last feature in the list of features mentioned above in the post.

  28. sur says:

    Update :

    Version 1.2.4 is up!! Checkout/Download the latest code.

    Repository will keeps on moving until the version 2.0.

    New Upcoming features for 2.0…
    1) Ajax based refresh(this feature is waiting since very to be incorporated)
    2) Option to select the captcha code from alphabets, numerals or mix
    3) Image Background effects.

    Stay Tuned!!

  29. jjb says:

    Sorry that post got cut off. I’ve posted the full info at http://www.jjbarrett.net/archives/problems-with-simple_captcha-in-rails-20

  30. PJ says:

    Just an update,

    I installed the latest svn checkout of Simple Captcha today, running Rails 1.2.6, and Restful Authentication.

    I made the change suggested by smooth, but having the same problems.

    PJ.

  31. In7 says:

    Thanks for a simple, elegant & excellent solution and i like it
    but i have tow questions with it:
    1. how to refresh the code image via a ajax?
    2. how to display number only in the code image?
    i much needed these feature, and hope for your help
    thanks very much~

  32. In7 says:

    i’m sorry,i don’t see Version 1.2.4 update when answer above question.
    it’s very helpful for me, thanks very much~

  33. sur says:

    @In7

    The first point is in the list of features that will be incorporated by the version 2.0.
    After getting your email, I have also added a feature related to your point 2. Here is the list.

    For the time being you can modify it this way to get it working…

    1) Ajax refresh is not just a tweak but a proper set of functions and needs to be tested for many rails’ versions, so I can not provide any help on that before 2.0

    2) To have the numerals instead of alphabets change the line #104 in the file(from the latest code) vendor/plugins/simple_captcha/lib/simple_captcha_action_view.rb to this…
    6.times{value << (48 + rand(10)).chr}

  34. Nermin says:

    Although everything works fine, I see this in my log file:
    SimpleCaptchaController: missing default helper path simple_captcha_helper

    Has anybody encountered the same error?

    Thanks.

  35. barraorion says:

    Today we updated the plugin and our application stopped working.
    We have concluded that the error was that in simple_captcha_action_controller.rb you define ApplicationController and our application took that ApplicationController instead the one defined in app/controller so it did not find any other method.

  36. fernando says:

    I have a problem with the rail version. When I try to do the “rake” the simple_captcha it says:

    can’t activate rails (= 2.0.2), already activated rails-1.2.5] (Gem:Exception)
    .
    .
    .
    #

  37. torsten says:

    it brakes html compatibility (XHTML 1.0) by not putting the stylesheet into the head of the page but into its body. How about making a separate stylesheet file to include in the head?

  38. Kengi says:

    Sur, one issue, my rails is 2.0.2, after svn up to 1.2.4
    my app/controllers/application.rb be ignored,
    I found the problem is the lib/simple_captcha_action_controller.rb

    class ApplicationController

  39. Kengi says:

    and one suggestion , pl’z let the img height , font size/left/top be some parameters.
    now in my case , the font align to bottom, no middle.
    I use your plugin via svn:externals, so I don’t want fix your code/css under vender.

    thanks

  40. sur says:

    UPDATE:

    The class ApplicationController’s definition has been removed from the plugin thus it will not interfere with other plugins.

    Latest Revision: 26

  41. desare says:

    I have problems with Simple Captcha in Opera, “redirect_to” in controller doesnt change image:

    if simple_captcha_valid?
    flash[:warning] = “Correct”
    ….

    else
    flash[:warning] = “Błędny kod”
    redirect_to :action => ‘register’

    return
    end

  42. qq says:

    After setup, I was able to see the captcha generated. But during simple_captcha_valid? call, I get a SystemStackError. Below is the stack trace. Please let me know if you know what is happening.

    SystemStackError (stack level too deep):
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract_adapter.rb:122:in `log_info’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:71:in `cache_sql’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/abstract/query_cache.rb:53:in `select_all’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:532:in `find_by_sql’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1233:in `find_every’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:503:in `find’
    C:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:695:in `destroy_all’
    /vendor/plugins/simple_captcha/lib/simple_captcha_data.rb:22:in `clear_old_data’
    /vendor/plugins/simple_captcha/lib/simple_captcha_data.rb:8:in `get_data’
    /vendor/plugins/simple_captcha/lib/simple_captcha_config.rb:19:in `simple_captcha_value’
    /vendor/plugins/simple_captcha/lib/simple_captcha_action_controller.rb:24:in `simple_captcha_valid?’

  43. Jeremy says:

    Glad you decided to move rmagick back into the plugin.

    One request: would it be possible to store the captcha answer as an encrypted string in a hidden form tag next to the captcha, rather than using the database? Users could define their own encryption key.

    Keep up the good work!

  44. Matz says:

    Hi Sur,
    i ‘m going to use your great plugin for my app, but i don’t why i get the following error when I try to do step 2: /rails/myapp/rake db:migrate

    This error appears:
    == CreateSimpleCaptchaData: migrating =========================================
    – create_table(:simple_captcha_data)
    rake aborted!
    undefined method `string’ for #

    (See full trace by running task with –trace)

    Thx a lot

    Matz

  45. PJ says:

    sur,

    I tried revision 26, it is working perfectly for me now!!! :)

    This is on Rails 1.2.6 and with RESTful Authentication.

    Just one thing, when i start my development server i get the following message:

    “SimpleCaptchaController: missing default helper path simple_captcha_helper”

    Everything works fine, but i still get that message…

    PJ.

  46. sur says:

    @matz,

    What version of Rails you are using, for rails < 2.0 you must use simple_captcha:setup_old in the first step.

  47. sur says:

    @Stephane,

    check out the latest revision of the plugin, the issue has been resolved.

  48. sur says:

    @Jeremy,

    I appreciate your suggestion. In one of the previous versions I was doing something near to that what you suggested, but found it might be possible to hack that logic. Currently this captcha is no way hackable.

    Was wondering if someone can get the set of 10-20 hashes and the code, might be able to resolve the hash logic! Still, this point needs a lot of discussion.

    But, yeah I am considering your suggestion for the version 2.0.

    Thanks.

  49. sur says:

    @qq

    I have noted down the point. Will look into this issue.

    Thanks.

  50. sur says:

    @desare,

    I checked in Opera, and found that its not refreshing the images properly. I have noted the issue for the version 2.0

    Thanks.

  51. sur says:

    @kengi,

    the issue has been fixed and the definition of the ApplicationController has been removed from the plugin.

    @torsten,

    If you have read this post properly, I have explicitly mentioned where is the CSS for the DOM objects of plugin resides.

  52. sur says:

    @barraorion,

    the issue has been fixed in the latest revision.

  53. quake wang says:

    Hi sur,
    Is it possible to add mini magick support, just like attachment_fu ( http://svn.techno-weenie.net/projects/plugins/attachment_fu/ ) ?

  54. Arlen says:

    Had a problem implementing this. My rails version was 2.0.2 (ActiveRecord 1.15.6) but when I migrated I got the following error:

    rake aborted!
    undefined method `string’ for #
    ./db/migrate//010_create_simple_captcha_data.rb:6:in `real_up’

    followed by a similar error to do with “t.timestamps”. I changed the migration file to:
    t.column “key”, :string, :limit => 40
    t.column “value”, :string, :limit => 6
    t.column :”created_at”, :datetime
    t.column :”updated_at”, :datetime

    from the t.string and t.timestamps entries, and it appears to have worked.

    No idea why it didn’t as the methods are supposed to be in Rails 2. I suspect this is a bug in Rails, or more specifically my webhost’s installation of rails, so I’m posting the fix here more for the benefit of others in my position than as a bug in simplecaptcha.

  55. Abdul Barek says:

    After installing i got the following error when trying to see my view file

    Status: 500 Internal Server Error Content-Type: text/html

    We’re sorry, but something went wrong.

    We’ve been notified about this issue and we’ll take a look at it shortly.

    Please suggest me if any one kind on me

  56. sur says:

    UPDATE

    New feature added. The helper method show_simple_captcha accepts the option :code_type which can be set to either ‘alphabetic’ or ‘numeric’.

  57. milind says:

    i wants work on simple captchas for earn money if you have work this type plese give me and i will work good

    thank you

  58. div says:

    Hi this really made my job simple…Thanks a lot for this simple n detailed description :)

  59. sur says:

    UPDATE

    Opera’s image refresh problem fixed.

  60. Preethi says:

    Thanks for the great plugin! Just a quick question (Not sure if this has already been answered). Is it possible to refresh the captcha image by means of an AJAX call? When I tried to do this (that is, by having an Ajax call render a partial which calls the show_simple_captcha function) the database does get updated with the new captcha, but the image is not refreshed. Can someone help me out?

    Thanks.

  61. sur says:

    @arlen
    You are getting this error because you have only updated Rails gem… but I can see the old ActiveRecord gem you are mentioning. With this gem you can not leverage the new Rails2.0 features.

    @milind
    I appreciate your thoughts for offering your services. But this is a small open source project to be used in my projects and I simply shared it that everyone can use it. I do not have any thoughts of get it done by outsourcing.

    @Preethi,
    The feature of Ajax refresh has already been mentioned as a part of the upcoming SimpleCaptcha-2.0 but at the moment its not there.
    Meanwhile I noticed that Kusakari has implemented the ajax refresh feature here (thanks Kusakari). Although I haven’t tried and tested it, you can try that out.

    The feature will soon be available in the plugin but somehow somewhat in different format.

    Thanks All for the patience.

  62. Preethi says:

    @Sur

    Thanks for the reply. Managed to get a slightly different version of Ajax implemented. Also, I’m developing on Windows, so for RMagick, I downloaded the RMagick+ImageMagick bundled version, and it works absolutely fine with Windows. I’m just wondering if it’ll work on Linux once it’s deployed. I have no idea why it will or it will not work, but I just want to get this clarified. It at all it will not work, can you tell me what Rmagick and ImageMagick packages I should install to get it working on any OS?

    Thanks.

  63. Preethi says:

    Essentially, I want to include RMagick and ImageMagick plugins with my project.

  64. Preethi says:

    Okie. Figured it out myself:D I’m loving all of this stuff!

  65. Ben says:

    This plugin is working brilliantly on Windows but on my Mac and on my Ubuntu server, the captcha images are show up as blank. Anybody know why this is happening?

  66. sur says:

    @Ben,

    two probable reasons…
    1) RMagick not properly installed… Make sure if RMagick is properly working.
    2) Missing Arial font… If you do not have the arial font, you can install it and try again if it works.

    Also, I have taken this point towards the version 2.0, I will bundle the font and also provide option to set the custom font.

  67. Arul says:

    Sur,

    Thanks a ton ! for your valuable contribution. I found the same problem
    as @arlen and fixed it by replacing the timestamp column name with
    updated_at. I didn’t need to create a created_at column. Let me know,
    if I have to ?, I don’t think your plug-in needs it for rails > 2.0.

    Here is the log for missing updated_at column ..


    ActiveRecord::StatementInvalid (Mysql::Error: Unknown column 'updated_at' in 'where clause': SELECT * FROM `simple_captcha_data` WHERE (updated_at

  68. Nabil says:

    sur,

    I commend you on this great work. I, however, unlike others, was not fortunate enough to have a smooth implementation. My challenge now is to pass beyond the following error message (whenever I try to launch my ..login/sign_up action):

    uninitialized constant SimpleCaptcha::ControllerHelpers::ConfigTasks

    this message appears when I use the controller based authentication method.

    As a separate note, applying the

    include SimpleCaptcha::ControllerHelpers

    in the Application.rb file is a disaster>>> it leads to the 505 error message!

    Please advise

    rgs

  69. Nabil says:

    Sur,

    I have to add that, after a frustrating night with the include call in the application.rb, I applied a require call instead from the controller as follows

    require ‘/vendor/plugins/simple_captcha/lib/simple_captcha_action_controller.rb’

    and that’s when the ‘uninitialized constant…’ error message appeared.

    Now, after I shifted the ‘include SimpleCaptcha::ControllerHelpers’ to the controller itself I started receiving the following error message

    undefined method `simple_captcha_valid?’ for #

    What am I doing wrong?

    please advise

    rgs,

  70. Nabil says:

    Sur,

    Last and lease (I hope!), I rebooted my server, and refreshed the …/login/sign_up action>>> yet another error message appeared

    uninitialized constant LoginController::SimpleCaptcha

    Is this enough for one day of confusion or what!

    rgs,

  71. sur says:

    @Nabil,

    I must say thats quite a wrong way to proceed.

    Just follow the steps I mentioned, to setup and then to use. Remove any extra include/require what you made in application.rb, restart the server now… and see!

  72. R Caveney says:

    Hello Sur,

    Works great on my development machine, but the image on the joyent accelerator is a little blob on the left side.

    I have the following versions of image_magick and rmagick:

    Version: ImageMagick 6.2.9 09/22/06 Q16 http://www.imagemagick.org

    rmagick (1.15.5)

    It is possible that one or both needs to be upgraded.

    Any thoughts?

    Many thanks in advance!

  73. D says:

    I have a doubt this showing captcha in Upper case no , so if some one enterd small letters it wont work na , how can i make it always upper using upcase function in ruby , so where should i add this code ??

  74. Brian Bruijn says:

    Just wanted to say thanks!! The plugin works perfectly for what Iam doing. My home env is Windows with instant rails (took a little work to get it running) and a Linux production environment. I will be able to using it for a comments tool I am developing as well as a registation tool!!! Great add to the community. Will be sure to link back to you in my blog about it!!

    Brian Bruijn

  75. sur says:

    Thanks Brian.

  76. [...] simple_captcha Used for registrations and other places where spam bots like to date [...]

  77. [...] simple captcha – zrzuca z nas ciężar ręcznego generowania obrazków captcha. Wystarczająco konfigurowalne dla półprofesjonalnych zastosowań (jako, że moim skromnym zdaniem jest dość proste do złamania, ale zbyt trudne dla prostych spam-botów). strona pluginu [...]

  78. [...] vous avez besoin d’intégrer un captcha dans un formulaire pour un projet Rails, Simple Captcha est un plugin de premier choix ! Une fois installé grâce à la commande [...]

  79. [...] some quick Googling for “rails captcha” and other terms, I discovered the simple_captcha plugin. This is a handy plugin that can be used to generate a CAPTCHA image with some convenient [...]

  80. [...] simple_captcha, plugin de geração de captcha para rails, não possui opção para colocar um imagem de fundo na [...]

  81. [...] simple_captcha – 画像認証機能を追加します。 [...]

  82. [...] Ugye ruby on rails-ben írtam meg a blog motorját, így gondoltam ehhez is van valami kész megoldás. Van. Ez: http://expressica.com/simple_captcha/ [...]

Sponsors