Rails 3 - ERROR Errno :: EINVAL:测试页面时参数无效

时间:2011-09-29 11:45:45

标签: ruby-on-rails ruby ruby-on-rails-3 webrick internal-server-error

HIO, 我需要帮助。我在Ruby on Rails 3中开发了应用程序。它的一些scadfolds和mysql数据库上只有CRUD操作的简单应用程序。因为我是Windows 64位用户,我有时会遇到一些宝石问题(例如mysql2 gem等)。但直到现在我已经解决了所有问题。现在我处于这种情况,当我有应用程序时,已经在localhost上测试它时,我在Web浏览器中收到此错误:

内部服务器错误 无效的论点 WEBrick / 1.3.1(Ruby / 1.8.7 / 2011-02-18)at localhost:300

Webrick日志:

*Started GET "/?mobile=0" for 127.0.0.1 at Thu Sep 29 13:25:53 +0200 2011
DEPRECATION WARNING: Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead. (called from C:/Sites/stodolist/app/controllers/application_controller.rb:8)
  Processing by UsersController#show as HTML
  Parameters: {"mobile"=>"0"}
  User Load (0.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  SQL (1.0ms)  BEGIN
  AREL (1.0ms)  UPDATE `users` SET `updated_at` = '2011-09-29 11:25:53', `perishable_token` = '0Mp7RB1VTjml8S7Syqh', `last_request_at` = '2011-09-29 11:25:53' WHERE `users`.`id` = 1
  SQL (22.0ms)  COMMIT
  Task Load (2.0ms)  SELECT `tasks`.* FROM `tasks` WHERE (`tasks`.user_id = 1)
  Priority Load (0.0ms)  SELECT `priorities`.* FROM `priorities` WHERE `priorities`.`id` = 1 LIMIT 1
  Cathegory Load (1.0ms)  SELECT `cathegories`.* FROM `cathegories` WHERE `cathegories`.`id` = 1 LIMIT 1
  Status Load (1.0ms)  SELECT `statuses`.* FROM `statuses` WHERE `statuses`.`id` = 1 LIMIT 1
  Priority Load (1.0ms)  SELECT `priorities`.* FROM `priorities` WHERE `priorities`.`id` = 2 LIMIT 1
  Cathegory Load (1.0ms)  SELECT `cathegories`.* FROM `cathegories` WHERE `cathegories`.`id` = 2 *LIMIT 1
  CACHE (0.0ms)  SELECT `statuses`.* FROM `statuses` WHERE `statuses`.`id` = 1 LIMIT 1*
  Priority Load (0.0ms)  SELECT `priorities`.* FROM `priorities` WHERE `priorities`.`id` = 3 LIMIT 1
  Cathegory Load (0.0ms)  SELECT `cathegories`.* FROM `cathegories` WHERE `cathegories`.`id` = 3 LIMIT 1
  CACHE (0.0ms)  SELECT `statuses`.* FROM `statuses` WHERE `statuses`.`id` = 1 LIMIT 1
  0m  SELECT `priorities`.* FROM `priorities` WHERE `priorities`.`id` = 4 LIMIT 1
  CACHE (0.0ms)  SELECT `cathegories`.* FROM `cathegories` WHERE `cathegories`.`id` = 1 LIMIT 1
  CACHE (0.0ms)  SELECT `statuses`.* FROM `statuses` WHERE `statuses`.`id` = 1 LIMIT 1
  Timeline Load (1.0ms)  SELECT `timelines`.* FROM `timelines` WHERE (`timelines`.user_id = 1)
Rendered users/show.html.erb within layouts/application (421.0ms)
Completed 200 OK in 619ms (Views: 448.0ms | ActiveRecord: 32.0ms)
[2011-09-29 13:25:57] ERROR Errno::EINVAL: Invalid argument*
    *C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/railsrack/log_tailer.rb:25:in `write'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:25:in `print'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:25:in `tail!'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/rack/log_tailer.rb:15:in `call'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/content_length.rb:13:in `call'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/handler/webrick.rb:52:in `service'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:95:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `each'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:92:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:23:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/webrick/server.rb:82:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/handler/webrick.rb:13:in `run'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rack-1.2.3/lib/rack/server.rb:217:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands/server.rb:65:in `start'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:30
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    C:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
    script/rails:6:in `require'
    script/rails:6*

每次点击某个link_to

时都会显示此错误

这是我的系统属性:

  1. Windows 7 x86
  2. 红宝石/ 1.8.7 / 2011-02-10
  3. 的WEBrick / 1.3.1
  4. Rails 3.0.7
  5. 我的路线:

    resources :priorities
    resources :timelines
    resources :cathegories
    resources :statuses
    resources :user_sessions
    resources :users
    resource :user, :as => 'account'
    resources :tasks  
    match 'signup' => 'users#new', :as => :signup  
    match 'admin' => "application#index",      :as => :admin  
    match 'login' => "user_sessions#new",      :as => :login
    match 'logout' => "user_sessions#destroy", :as => :logout
    
    root :to => "users#show"
    

    真的没有错误在哪里:(我认为它可以在路线...... 我很愚蠢的问题,我是新手......

    开发日志: 它奇怪的因为服务器日志看起来像这样:

    Started GET "/user" for 127.0.0.1 at Thu Sep 29 14:12:00 +0200 2011
    DEPRECATION WARNING: Setting filter_parameter_logging in ActionController is deprecated and has no longer effect, please set 'config.filter_parameters' in config/application.rb instead. (called from C:/Sites/stodolist/app/controllers/application_controller.rb:8)
      Processing by UsersController#show as HTML
      [1m[35mUser Load (1.0ms)[0m  SELECT `users`.* FROM `users` WHERE `users`.`persistence_token` = '6e8fba00deefc7922358a3022942302058a31133d7b2dc98bcc1620a06869d36f81c5f42789da7e4fb7b36bddfd4ad628fe547fde111d9fe18af823e0698e8d5' LIMIT 1
      [1m[36mUser Load (2.0ms)[0m  [1mSELECT `users`.* FROM `users` WHERE `users`.`id` = 4 LIMIT 1[0m
      [1m[35mSQL (0.0ms)[0m  BEGIN
      [1m[36mAREL (0.0ms)[0m  [1mUPDATE `users` SET `updated_at` = '2011-09-29 12:12:01', `last_request_at` = '2011-09-29 12:12:01', `perishable_token` = 'v4g9FCSyQfuOAIFXfUQ' WHERE `users`.`id` = 4[0m
      [1m[35mSQL (82.0ms)[0m  COMMIT
      [1m[36mTask Load (1.0ms)[0m  [1mSELECT `tasks`.* FROM `tasks` WHERE (`tasks`.user_id = 4)[0m
      [1m[35mTimeline Load (1.0ms)[0m  SELECT `timelines`.* FROM `timelines` WHERE (`timelines`.user_id = 4)
    Rendered users/show.html.erb within layouts/application (115.0ms)
    Completed 200 OK in 321ms (Views: 143.0ms | ActiveRecord: 87.0ms)
    

1 个答案:

答案 0 :(得分:0)

好的,我找到了这个问题的解决方案。我决定将我的网络服务器更改为morgel。工作两个小时后,没有错误。也许这个问题真的让我失去了环境--Win 64bit / ruby​​ / mysql / rails3和webrick。我会看看它是怎么回事......