Rails服务器突然崩溃了

时间:2013-02-07 21:05:19

标签: ruby-on-rails ruby ruby-on-rails-3 devise

我正在开发一个应用程序,rails servr工作正常,但突然停止了。我尝试重新启动我的系统(iOS)并一次又一次启动服务器,我收到此错误 -

/Users/alokdas/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

/Users/alokdas/.rvm/gems/ruby-1.9.3-p374@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:197: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777

=> Booting WEBrick

=> Rails 3.2.11 application starting in development on htt.://0.0.0.3000

=> Call with -d to detach

=> Ctrl-C to shutdown server

Exiting

/Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/length.rb:14:in `initialize': :in and :within must be a Range (ArgumentError)

    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:82:in `new'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:82:in `block in validates_with'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:81:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/with.rb:81:in `validates_with'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activemodel-3.2.11/lib/active_model/validations/length.rb:121:in `validates_length_of'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:35:in `block in included'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:28:in `class_eval'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models/validatable.rb:28:in `included'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:112:in `include'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:112:in `block (2 levels) in devise'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:92:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:92:in `block in devise'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:123:in `devise_modules_hook!'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/models.rb:90:in `devise'
    from /users/alokdas/code/omrails/app/models/view.rb:5:in `<class:View>'
    from /users/alokdas/code/omrails/app/models/view.rb:1:in `<top (required)>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `load'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:469:in `block in load_file'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:639:in `new_constants_in'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:468:in `load_file'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:353:in `require_or_load'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:502:in `load_missing_constant'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:192:in `block in const_missing'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:190:in `const_missing'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:230:in `block in constantize'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/inflector/methods.rb:229:in `constantize'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:554:in `get'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:588:in `constantize'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:267:in `get'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:77:in `to'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:72:in `modules'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:89:in `routes'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:156:in `default_used_route'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/mapping.rb:66:in `initialize'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:301:in `new'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise.rb:301:in `add_mapping'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:208:in `block in devise_for'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/devise-2.2.3/lib/devise/rails/routes.rb:207:in `devise_for'
    from /users/alokdas/code/omrails/config/routes.rb:2:in `block in <top (required)>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:282:in `instance_exec'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:282:in `eval_block'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/actionpack-3.2.11/lib/action_dispatch/routing/route_set.rb:260:in `draw'
    from /users/alokdas/code/omrails/config/routes.rb:1:in `<top (required)>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `block in load'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:245:in `load'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:40:in `load_paths'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:16:in `reload!'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:26:in `block in updater'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `call'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/file_update_checker.rb:78:in `execute'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:27:in `updater'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/routes_reloader.rb:7:in `execute_if_updated'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application/finisher.rb:66:in `block in <module:Finisher>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:30:in `run'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `each'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/application.rb:136:in `initialize!'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /users/alokdas/code/omrails/config/environment.rb:5:in `<top (required)>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `block in require'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:in `load_dependency'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in `require'
    from /users/alokdas/code/omrails/config.ru:3:in `block in <main>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:51:in `initialize'
    from /users/alokdas/code/omrails/config.ru:in `new'
    from /users/alokdas/code/omrails/config.ru:in `<main>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:40:in `eval'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/builder.rb:40:in `parse_file'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:200:in `app'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/server.rb:46:in `app'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:304:in `wrapped_app'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/rack-1.4.4/lib/rack/server.rb:254:in `start'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands/server.rb:70:in `start'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:55:in `block in <top (required)>'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:50:in `tap'
    from /Users/alokdas/.rvm/gems/ruby-1.9.3-p374/gems/railties-3.2.11/lib/rails/commands.rb:50:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

就在此之前我跑了 - rails generate devise:views

感谢您的帮助

更多信息 -

  1. 我曾经使用过 - rails generate devise:install - 之前它创建了一个注册页面。
  2. 现在我记得我曾经使用过命令'rails generate devise views'(中间没有冒号),它创建了一些文件,但不确定在哪里。这会产生一些冲突吗?
  3. 这是我的模型

    中的view.rb文件

    class View&lt;的ActiveRecord :: Base的   #包括默认设计模块。其他可用的是:   #:token_authenticatable,:确认,   #:lockable,:timeoutable和:omniauthable      设计:database_authenticatable,:registerable,             :可恢复的,:可记住的,:可跟踪的,:有效的

    #为您的模型设置可访问(或受保护)属性     attr_accessible:email,:password,:password_confirmation,:remember_me   #attr_accessible:title,:body 端

1 个答案:

答案 0 :(得分:1)

看起来你没有运行rails g devise:install,我认为如果你运行rails g命令它也会失败。最佳选择,再次尝试安装设备,如果失败,请手动删除所有设备相关文件,然后重试。