0

I recently updated from Rails 3.2.9 (Ruby 1.9.2) to Rails 3.2.0 (Ruby 2.0.0). I have been getting errors from MySQL regarding some data being too long for columns. I came across this stackoverflow question, but it seems like the solution is for Rails 4.x only: I tried setting strict: false in my database.yml, but this did not work.

Community
  • 1
  • 1
RailinginDFW
  • 1,523
  • 12
  • 19

1 Answers1

2

You can do

   SET @@global.sql_mode= '';

or you can add it in your file

   sql_mode: 'traditional'

or too

   strict_mode: false
vmontanheiro
  • 1,009
  • 9
  • 12
  • 1
    Kindly post a sample database.yml file. I am unable to make the suggestions work – RailinginDFW Nov 05 '14 at 17:14
  • Currently I'm not working with rails. You need to look for database.yml file. Inside there you will find the variables sql_mode or strict_mode. If not exists you should create. http://api.rubyonrails.org/classes/ActiveRecord/ConnectionAdapters/MysqlAdapter.html – vmontanheiro Nov 05 '14 at 17:26
  • Setting the global.sql_mode in MySQL directly worked. Seems like the sql_mode in MySQL 5.6.x is STRICT_TRANS_TABLE. – RailinginDFW Nov 06 '14 at 16:24