GithubHelp home page GithubHelp logo

simple-captcha's People

Contributors

chipiga avatar galetahub avatar ignacy avatar wxianfeng avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

ery

simple-captcha's Issues

attr_accessible 无法使用

ActionView::Template::Error (`attr_accessible` is extracted out of Rails into a gem. Please use new recommended protection model for params(strong_parameters) or add `protected_attributes` to your Gemfile to use old one.):
    1: <img src="<%=show_image_src%>" />
  app/views/simple_captcha/_refresh_captcha.erb:1:in `_app_views_simple_captcha__refresh_captcha_erb___969010130719052539_21078440'
  app/controllers/welcome_controller.rb:6:in `refresh_captcha'

StandardError (Error while running convert: convert: unable to read font `/usr/share/fonts/default/TrueType/arial.ttf'.

我的环境:

[wxianfeng@webserver log]$ cat /etc/issue
CentOS release 5.5 (Final)
Kernel \r on an \m

[wxianfeng@webserver log]$ convert -version
Version: ImageMagick 6.2.8 05/07/12 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

因为系统中没有 TrueType 字体导致, 安装上即可

>wget http://www.osresources.com/files/centos-windows-fonts/msfonts.tbz
>sudo mkdir -p mkdir /usr/share/fonts/default/TrueType
>sudo tar xvjpf msfonts.tbz -C /usr/share/fonts/default/TrueType/

ruby 2.0 + rails 4.0 报错: ArgumentError (could not find a temporary directory):

backtrace:

ArgumentError (could not find a temporary directory):
  /home/zzq/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tmpdir.rb:34:in `tmpdir'
  /home/zzq/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tmpdir.rb:105:in `tmpdir'
  /home/zzq/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tmpdir.rb:137:in `create'
  /home/zzq/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/tempfile.rb:136:in `initialize'
  wxianfeng_simple_captcha (0.4.0) lib/simple_captcha/image.rb:70:in `new'
  wxianfeng_simple_captcha (0.4.0) lib/simple_captcha/image.rb:70:in `generate_simple_captcha_image'
  wxianfeng_simple_captcha (0.4.0) app/controllers/simple_captcha_controller.rb:12:in `show'
  actionpack (4.0.0) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:189:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__997551844__process_action__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:31:in `block in process_action'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `block in instrument'
  activesupport (4.0.0) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (4.0.0) lib/active_support/notifications.rb:159:in `instrument'
  actionpack (4.0.0) lib/action_controller/metal/instrumentation.rb:30:in `process_action'
  actionpack (4.0.0) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
  activerecord (4.0.0) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (4.0.0) lib/abstract_controller/base.rb:136:in `process'
  actionpack (4.0.0) lib/abstract_controller/rendering.rb:44:in `process'
  actionpack (4.0.0) lib/action_controller/metal.rb:195:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal/rack_delegation.rb:13:in `dispatch'
  actionpack (4.0.0) lib/action_controller/metal.rb:231:in `block in action'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:80:in `dispatch'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:48:in `call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:71:in `block in call'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `each'
  actionpack (4.0.0) lib/action_dispatch/journey/router.rb:59:in `call'
  actionpack (4.0.0) lib/action_dispatch/routing/route_set.rb:655:in `call'
  rack (1.5.2) lib/rack/etag.rb:23:in `call'
  rack (1.5.2) lib/rack/conditionalget.rb:25:in `call'
  rack (1.5.2) lib/rack/head.rb:11:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/params_parser.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/flash.rb:241:in `call'
  rack (1.5.2) lib/rack/session/abstract/id.rb:225:in `context'
  rack (1.5.2) lib/rack/session/abstract/id.rb:220:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/cookies.rb:486:in `call'
  activerecord (4.0.0) lib/active_record/query_cache.rb:36:in `call'
  activerecord (4.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:626:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:29:in `block in call'
  activesupport (4.0.0) lib/active_support/callbacks.rb:373:in `_run__378373351__call__callbacks'
  activesupport (4.0.0) lib/active_support/callbacks.rb:80:in `run_callbacks'
  actionpack (4.0.0) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/remote_ip.rb:76:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/debug_exceptions.rb:17:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/show_exceptions.rb:30:in `call'
  railties (4.0.0) lib/rails/rack/logger.rb:38:in `call_app'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `block in call'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `block in tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:25:in `tagged'
  activesupport (4.0.0) lib/active_support/tagged_logging.rb:67:in `tagged'
  railties (4.0.0) lib/rails/rack/logger.rb:21:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/request_id.rb:21:in `call'
  rack (1.5.2) lib/rack/methodoverride.rb:21:in `call'
  rack (1.5.2) lib/rack/runtime.rb:17:in `call'
  activesupport (4.0.0) lib/active_support/cache/strategy/local_cache.rb:83:in `call'
  actionpack (4.0.0) lib/action_dispatch/middleware/static.rb:64:in `call'
  railties (4.0.0) lib/rails/engine.rb:511:in `call'
  railties (4.0.0) lib/rails/application.rb:97:in `call'
  rack (1.5.2) lib/rack/content_length.rb:14:in `call'
  thin (1.5.1) lib/thin/connection.rb:81:in `block in pre_process'
  thin (1.5.1) lib/thin/connection.rb:79:in `catch'
  thin (1.5.1) lib/thin/connection.rb:79:in `pre_process'
  thin (1.5.1) lib/thin/connection.rb:54:in `process'
  thin (1.5.1) lib/thin/connection.rb:39:in `receive_data'
  eventmachine (1.0.3) lib/eventmachine.rb:187:in `run_machine'
  eventmachine (1.0.3) lib/eventmachine.rb:187:in `run'
  thin (1.5.1) lib/thin/backends/base.rb:63:in `start'
  thin (1.5.1) lib/thin/server.rb:159:in `start'
  rack (1.5.2) lib/rack/handler/thin.rb:16:in `run'
  rack (1.5.2) lib/rack/server.rb:264:in `start'
  railties (4.0.0) lib/rails/commands/server.rb:84:in `start'
  railties (4.0.0) lib/rails/commands.rb:78:in `block in <top (required)>'
  railties (4.0.0) lib/rails/commands.rb:73:in `tap'
  railties (4.0.0) lib/rails/commands.rb:73:in `<top (required)>'
  bin/rails:4:in `require'
  bin/rails:4:in `<main>'

rails4 使用 0.2.0 报route错误

wxianfeng@wxianfeng:/data/projects/ops$ rails  s 
=> Booting WEBrick
=> Rails 4.0.0.beta1 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:193:in `normalize_conditions!': You should not use the `match` method in your router without specifying an HTTP method. (RuntimeError)
If you want to expose your action to GET, use `get` in the router:

  Instead of: match "controller#action"
  Do: get "controller#action"
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:64:in `initialize'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1425:in `new'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1425:in `add_route'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1404:in `decomposed_match'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `block in match'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `each'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/mapper.rb:1386:in `match'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/wxianfeng_simple_captcha-0.2.0/config/routes.rb:2:in `block in <top (required)>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:320:in `instance_exec'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:320:in `eval_block'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/actionpack-4.0.0.beta1/lib/action_dispatch/routing/route_set.rb:298:in `draw'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/wxianfeng_simple_captcha-0.2.0/config/routes.rb:1:in `<top (required)>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `block in load'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/dependencies.rb:222:in `load'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `each'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/file_update_checker.rb:75:in `call'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.beta1/lib/active_support/file_update_checker.rb:75:in `execute'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `instance_exec'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:30:in `run'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:183:in `block (2 levels) in each_strongly_connected_component'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:219:in `each_strongly_connected_component_from'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:182:in `block in each_strongly_connected_component'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:in `each'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component'
    from /home/wxianfeng/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_each'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/initializable.rb:54:in `run_initializers'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/application.rb:213:in `initialize!'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /data/projects/ops/config/environment.rb:5:in `<top (required)>'
    from /data/projects/ops/config.ru:3:in `require'
    from /data/projects/ops/config.ru:3:in `block in <main>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `instance_eval'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:55:in `initialize'
    from /data/projects/ops/config.ru:in `new'
    from /data/projects/ops/config.ru:in `<main>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `new_from_string'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/builder.rb:40:in `parse_file'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:277:in `build_app_and_options_from_config'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:199:in `app'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:46:in `app'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/commands/server.rb:71:in `start'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:78:in `block in <top (required)>'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `tap'
    from /home/wxianfeng/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.beta1/lib/rails/commands.rb:73:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.