Gabi
Gabi

Reputation: 250

ActiveRecord How to figure out NULL fields

How I may filter NULL fields

no_repeat = Events.where(:repeat => NULL)

NULL word doesn't work

Upvotes: 1

Views: 45

Answers (1)

Luís Ramalho
Luís Ramalho

Reputation: 10208

You can do it like so:

no_repeat = Events.where("repeat IS NULL")

no_repeat = Events.where("repeat = ?", nil)

no_repeat = Events.where(:repeat => nil)
no_repeat = Events.where(repeat: nil)

Upvotes: 2

Related Questions