0

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 value).

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.

simianarmy
  • 1,485
  • 10
  • 13
  • Check the logs when the form submission is done, see if things are being passed correctly. If you are seeing values in the console show up, but errors are occurring when you try to save a record after passing a hash to it, that could very well be the issue. – agmcleod Sep 29 '11 at 22:18
  • This is a mature well-tested app so no easy solutions I'm afraid. This issue is unique to using Ruby >= 1.9 since almost everything else in the codebase has not been changed. – simianarmy Sep 29 '11 at 23:03
  • Working: OS X Lion, Ruby ree-1.8.7-2011.03, nginx/1.0.5, passenger 3.0.8, Rails 2.3.8 – simianarmy Sep 30 '11 at 17:23

1 Answers1

0

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.

simianarmy
  • 1,485
  • 10
  • 13