Skip to content

Commit

Permalink
tweaked isnull to run on postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
chrismatthieu committed Feb 26, 2011
1 parent 9841f1f commit d598df5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/api_controller.rb
@@ -1,9 +1,11 @@
class ApiController < ApplicationController
def check

# WORKS IN MYSQL
# @reminders = Reminder.where("(appointment > ?) && (appointment < ?) && ( ISNULL(flag1) || ISNULL(flag2) || ISNULL(flag3))", Time.now.utc, Time.now.utc+1.week)

@reminders = Reminder.where("(appointment > ?) && (appointment < ?) && ( flag1 IS NULL || flag2 IS NULL || flag3 IS NULL)", Time.now.utc, Time.now.utc+1.week)
# WORKS IN POSTGRES
@reminders = Reminder.where("(appointment > ?) && (appointment < ?) && ( flag1 = 0 || flag2 = 0 || flag3 = 0)", Time.now.utc, Time.now.utc+1.week)


@reminders.each do |reminder|
Expand Down
4 changes: 4 additions & 0 deletions app/controllers/reminders_controller.rb
Expand Up @@ -41,6 +41,10 @@ def edit
# POST /reminders.xml
def create
@reminder = Reminder.new(params[:reminder])

@reminder.flag1 = 0
@reminder.flag2 = 0
@reminder.flag3 = 0

respond_to do |format|
if @reminder.save
Expand Down

0 comments on commit d598df5

Please sign in to comment.