Windows Rails 3 Errno::ECONNABORTED & Authlogic not working properly & Development 500 error

StackOverflow https://stackoverflow.com/questions/12759281

質問

I'm developing rails app and everything was working fine, but now it started bugging. I have implemented ActionMailer with Authlogic perishable token and now, everytime I try to access UsersController#show it only show me Error 500.

We're sorry, but something went wrong.

and in Server Console

Started GET "/users/1" for 127.0.0.1 at 2012-10-06 13:04:46 +0200
Processing by UsersController#show as HTML
  Parameters: {"id"=>"1"}
  User Load (2.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
   (1.0ms)  BEGIN
   (1.0ms)  UPDATE `users` SET `last_request_at` = '2012-10-06 11:04:46', `perishable_token` = 'eFBAhfqGX2p04ZfYGb9w', `updated_at` = '2012-10-06 11:04:46' WHERE `users`.`id` = 1
   (3.0ms)  COMMIT
  User Load (1.0ms)  SELECT `users`.* FROM `users` WHERE `users`.`id` = 1 LIMIT 1
  Rendered users/show.html.erb within layouts/application (99.0ms)
Completed 500 Internal Server Error in 169ms

development.log is empty. Also when I restart server, my session doesn't expire, so I stay logged after restart. After some time i found that sometime server throws this error

[2012-10-06 13:11:39] ERROR Errno::ECONNABORTED: Software v hostitelsk�m poc�taci ukoncil vytvoren� pripojen�.
    C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:80:in `eof?'
    C:/Ruby193/lib/ruby/1.9.1/webrick/httpserver.rb:80:in `run'
    C:/Ruby193/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
C:/Ruby193/lib/ruby/1.9.1/webrick/htmlutils.rb:19: warning: regexp match /.../n against to CP850 string
C:/Ruby193/lib/ruby/1.9.1/webrick/htmlutils.rb:20: warning: regexp match /.../n against to CP850 string
C:/Ruby193/lib/ruby/1.9.1/webrick/htmlutils.rb:21: warning: regexp match /.../n against to CP850 string
C:/Ruby193/lib/ruby/1.9.1/webrick/htmlutils.rb:22: warning: regexp match /.../n against to CP850 string

I have tried to work with rails/console everything worked fine. I run out of options and I'm stuck. I would appreciate any help.

役に立ちましたか?

解決

The problem was in error encoding in models file. I'm using UTF-8 (for latin2 characters) and I need to add this at the start of every file where I want to use diacritic

#encoding: utf-8

Unfortunately I don't know any better way. If I will use diacritic in a file without encoding set, rails will throw error about invalid multibyte char (US-ASCII). So UsersController#show uses a user.rb method that uses report.rb method. There was diacritic in method.rb file, but I forgot to add encoding line. Somehow Ruby on Rails couldn't handle that error. and it result into 500 Internal Error

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top