search function

This commit is contained in:
Andreas Stephanides
2014-02-08 16:39:56 +01:00
parent 05dbffd4f6
commit d3ac7504dc
11 changed files with 122 additions and 38 deletions

View File

@@ -18,6 +18,7 @@ class Thema < ActiveRecord::Base
has_one :gremium
validates :themengruppe, :presence => true
validates :title, :presence => true
scope :search, ->(query) {where("text like ? or title like ?", "%#{query}%", "%#{query}%")}
translates :title,:text, :versioning =>true, :fallbacks_for_empty_translations => true
end