我在一个封闭的博客和讨论网络应用程序上工作,一切都很好;设计,康康,登录,一切正常。当我为实现跟随其他用户的用户/关系模型进行调整时,服务器崩溃了。这是运行服务器的控制台出现的问题。希望它并没有表明我是一个多么糟糕的编码器。我不知道这个粘贴有多少是相关的,但实际的崩溃是在最底层。
Started GET "/user/dyylannnn" for 127.0.0.1 at Wed Aug 01 12:12:48 -0400 2012
SQLite3::ConstraintException (columns follower_id, followed_id are not unique):
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:69:in `close'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:69:in `dealloc'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:58:in `clear'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:57:in `each'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:57:in `clear'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:144:in `clear_cache!'
activerecord (3.2.7) lib/active_record/connection_adapters/sqlite_adapter.rb:138:in `disconnect!'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:151:in `clear_reloadable_connections!'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:149:in `each'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:149:in `clear_reloadable_connections!'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:147:in `clear_reloadable_connections!'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:386:in `clear_reloadable_connections!'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:386:in `each_value'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_pool.rb:386:in `clear_reloadable_connections!'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_specification.rb:186:in `__send__'
activerecord (3.2.7) lib/active_record/connection_adapters/abstract/connection_specification.rb:186:in `clear_reloadable_connections!'
activerecord (3.2.7) lib/active_record/railtie.rb:96:in `_callback_before_3'
activesupport (3.2.7) lib/active_support/callbacks.rb:429:in `_run__2144987145__prepare__4__callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `send'
activesupport (3.2.7) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.7) lib/active_support/callbacks.rb:385:in `_run_prepare_callbacks'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in `send'
activesupport (3.2.7) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.7) lib/action_dispatch/middleware/reloader.rb:74:in `prepare!'
actionpack (3.2.7) lib/action_dispatch/middleware/reloader.rb:64:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.7) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.7) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.7) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.7) lib/action_dispatch/middleware/static.rb:62:in `call'
railties (3.2.7) lib/rails/engine.rb:479:in `call'
railties (3.2.7) lib/rails/application.rb:220:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.7) lib/rails/rack/log_tailer.rb:17:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
rack (1.4.1) lib/rack/handler/webrick.rb:13:in `run'
rack (1.4.1) lib/rack/server.rb:265:in `start'
railties (3.2.7) lib/rails/commands/server.rb:70:in `start'
railties (3.2.7) lib/rails/commands.rb:55
railties (3.2.7) lib/rails/commands.rb:50:in `tap'
railties (3.2.7) lib/rails/commands.rb:50
script/rails:6:in `require'
script/rails:6
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.7/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.2ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.7/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (1.0ms)
Rendered /Library/Ruby/Gems/1.8/gems/actionpack-3.2.7/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (13.5ms)
/Library/Ruby/Gems/1.8/gems/activerecord-3.2.7/lib/active_record/connection_adapters/sqlite_adapter.rb:69: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
Abort trap
所以我喜欢"嗯,这很奇怪,"并重新启动服务器,但现在一切都坏了。行为人似乎是Devise。如果不是'current_user不是未定义的本地变量或方法,那么我的导航栏(bootstrap ftw)中的Devise实现也会被破坏。不管错误是什么,我网站上的每一页都被破坏了,而且这一切似乎都与设计有关。
我正在做这个项目以熟悉Rails,我非常喜欢它,但我还是新手,我不知道wtf刚刚发生过。救命?我可以粘贴你们可能要求的任何其他代码。
答案 0 :(得分:0)
如果您的开发机器尝试重新创建数据库
rake db:drop
rake db:create
答案 1 :(得分:0)
你可能有一个损坏的宝石。尝试
bundle exec gem uninstall <devise gem name>
无论你使用什么版本的Devise。然后再次运行bundle install
。这应该卸载并重新安装Devise gem。
如果这不起作用,您可以尝试将存储库克隆到新目录的强力方法。