Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed sqlite compat in page model

  • Loading branch information...
commit 2f69919df06a0c46e48f4f7446c76e1fc642e2d0 1 parent c9b1806
@jbbarth jbbarth authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 app/models/page.rb
View
6 app/models/page.rb
@@ -64,20 +64,20 @@ def before_update
# get a page based on permalink
def self.find_by_link(permalink)
- self.find(:first, :conditions => ['is_active = 1 and permalink = ?', permalink])
+ self.find(:first, :conditions => ['is_active = ? and permalink = ?', true, permalink])
end
# find all pages in the db that contain string
def self.find_by_string(str, limit = 20, active_only = false)
# use the search lib to run this search
- results = self.search(str, {:conditions => (active_only ? 'is_active = 1' : nil), :limit => limit})
+ results = self.search(str, {:conditions => (active_only ? ['is_active = ?', true] : nil), :limit => limit})
if (results.length > 1) or (str.downcase.index(' and '))
# if the first search returned something or there was an AND operator
return results
else
# first search didn't find anthing, let's try it with the OR operator
simple_str = str.gsub(' ',' OR ')
- return self.search(simple_str, {:conditions => (active_only ? 'is_active = 1' : nil), :limit => limit})
+ return self.search(simple_str, {:conditions => (active_only ? ['is_active = ?', true] : nil), :limit => limit})
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.