0

How can I Insert the value null to a database column with ruby code? I'm using a rails application.

1
  • 1
    What does the table definition look like in your schema.rb? Commented Nov 3, 2010 at 13:33

2 Answers 2

6
user.title = nil
user.save
Sign up to request clarification or add additional context in comments.

2 Comments

I tried to save the value nil to the database but the database saves the value 'on'.. Is this some ruby related problem?
depend how you column is define.
0

As shingara said or:

user.update_attribute(:title, nil)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.