I have searched all over and cannot find anyone with the same problem.
I am testing upgrading a large Rails app running Rails 2.3.8 with Ruby 1.9.2 using rvm and nginx+passenger (currently running on 1.8.7 in production).
I'm using the mysql2 gem, and my database uses UTF-8 encoding. When I login to the app (standard restful-auth), the db lookup finds a match but when the controller tries to save an attribute change on the User model, it raises a validation error from validates_length_of.
I added some debugging output to ActiveRecord and it looks like it thinks all my database record's string values are empty (show up as "[]" in the logs...)
I was seeing the same behavior in script/console: User.first.login => "[]", but it was fixed after switching to the mysql2 gem (and updating database.yml adapter val开发者_开发知识库ue).
Why would the console work but not via the website? ActionController / ActiveSupport bug??
Clarification: This is a stable app that has been live for 1+ years in 1.8.7 with hundreds of specs.
The solution was to disable the xss_terminate plugin.
It is old but was quite useful for me to deal with various user input types and roles.. Obviously hooks way to close to ActiveRecord operations dealing with strings to be useful in Ruby 1.9.
精彩评论