Showing
3 changed files
with
15 additions
and
0 deletions
... | @@ -10,6 +10,8 @@ gem 'heimdall_engine', git: 'git@git.ukko.mx:iker.n/heimdall-engine.git', branch | ... | @@ -10,6 +10,8 @@ gem 'heimdall_engine', git: 'git@git.ukko.mx:iker.n/heimdall-engine.git', branch |
10 | gem 'paranoia' | 10 | gem 'paranoia' |
11 | gem 'paper_trail' | 11 | gem 'paper_trail' |
12 | gem 'will_paginate' | 12 | gem 'will_paginate' |
13 | +gem 'nested_form' | ||
14 | +gem 'simple_form' | ||
13 | 15 | ||
14 | 16 | ||
15 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | 17 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' | ... | ... |
... | @@ -111,6 +111,7 @@ GEM | ... | @@ -111,6 +111,7 @@ GEM |
111 | mini_portile2 (2.3.0) | 111 | mini_portile2 (2.3.0) |
112 | minitest (5.11.3) | 112 | minitest (5.11.3) |
113 | multi_json (1.13.1) | 113 | multi_json (1.13.1) |
114 | + nested_form (0.3.2) | ||
114 | nio4r (2.3.1) | 115 | nio4r (2.3.1) |
115 | nokogiri (1.8.2) | 116 | nokogiri (1.8.2) |
116 | mini_portile2 (~> 2.3.0) | 117 | mini_portile2 (~> 2.3.0) |
... | @@ -231,12 +232,14 @@ DEPENDENCIES | ... | @@ -231,12 +232,14 @@ DEPENDENCIES |
231 | jbuilder (~> 2.5) | 232 | jbuilder (~> 2.5) |
232 | jquery-rails | 233 | jquery-rails |
233 | listen (~> 3.0.5) | 234 | listen (~> 3.0.5) |
235 | + nested_form | ||
234 | paper_trail | 236 | paper_trail |
235 | paranoia | 237 | paranoia |
236 | pg | 238 | pg |
237 | puma (~> 3.0) | 239 | puma (~> 3.0) |
238 | rails (~> 5.0.6) | 240 | rails (~> 5.0.6) |
239 | sass-rails (~> 5.0) | 241 | sass-rails (~> 5.0) |
242 | + simple_form | ||
240 | slim | 243 | slim |
241 | spring | 244 | spring |
242 | spring-watcher-listen (~> 2.0.0) | 245 | spring-watcher-listen (~> 2.0.0) | ... | ... |
app/models/match.rb
0 → 100644
1 | +class Match < ApplicationRecord | ||
2 | + | ||
3 | + belongs_to :pool, inverse_of: :matches | ||
4 | + has_many :bets, dependent: :destroy, inverse_of: :match | ||
5 | + validates :home, :away, :date, :pool, presence: true | ||
6 | + enum result: [:home, :tie, :away] | ||
7 | + | ||
8 | + scope :active, -> { joins(:pool).where(pools: { active: true}) } | ||
9 | + scope :upcoming, -> { active.where('date > ?', Time.zone.now) } | ||
10 | +end |
-
Please register or login to post a comment