1
0
mirror of https://github.com/jcwimer/wrestlingApp synced 2026-04-04 22:03:49 +00:00

Added tournament search

This commit is contained in:
2016-01-04 19:20:05 +00:00
parent 7a14e5f74a
commit c012682e77
4 changed files with 16 additions and 4 deletions

View File

@@ -11,6 +11,10 @@ class Tournament < ActiveRecord::Base
validates :date, :name, :tournament_type, :address, :director, :director_email , presence: true
def self.search(search)
where("date LIKE ? or name LIKE ?", "%#{search}%", "%#{search}%")
end
def daysUntil
time = (Date.today - self.date).to_i
if time < 0