xirukitepe
xirukitepe

Reputation: 1615

Multiple conditions in Rails console

Hello I'm finding it hard to make this work.

I'm having an error which is syntax error.

I want to use where clause to find users who are created_at during a specified date and at the same time those users who don't have profile pic

I have here

User.where(:conditions => {"date(created_at) = ? AND profilepic = ?", '2012-08-10', 'nil'})

What's the problem. And what are the other ways.

Upvotes: 0

Views: 1621

Answers (1)

xdazz
xdazz

Reputation: 160833

It should be

User.where('date(created_at) = ? AND profilepic IS NULL',  '2012-08-10')

Upvotes: 1

Related Questions