1

I just used this to switch my rails app db from sqlite3 to mysql2 and that seemed to work out properly.

But when I start up my app I'm now getting this:

A ActionView::Template::Error occurred in pages#dashboard:

Mysql2::Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '== 1) LIMIT 20 OFFSET 0' at line 1: SELECT `tickets`.* FROM `tickets` WHERE (archived == 1) LIMIT 20 OFFSET 0
activerecord (3.0.3) lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log'

Not sure where to look to get this working properly. Any help would be appreciated. Thanks!

Community
  • 1
  • 1
Marc
  • 2,584
  • 5
  • 33
  • 47
  • I have this error when I navigate to rails admin and try to edit one of my users.do you have any ideas ? – Afsanefda Sep 05 '17 at 10:33

1 Answers1

4

Try this:

# Notice single = vs ==
WHERE (archived = 1)

Update Ended up doing

scope :is_archived, where('archived != ?', 1)
scope :not_archived, where('archived = ?', 1)

This worked great. Thanks!

Marc
  • 2,584
  • 5
  • 33
  • 47
Mike Purcell
  • 19,847
  • 10
  • 52
  • 89