mysql - Insert NULL value in db using Raw sql queries in rails -


i using raw sql queries in rails application. want insert null value in 1 rows, how active record using nil row when table.find_by_column(nil). tried '#{nil}' entering nothing db column blank ' ' want null.

you can try this.

sql = "insert table_name (r_id, r_name) values (1, null)"  records_array = activerecord::base.connection.execute(sql) 

Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -