Show More
Commit Description:
add model solution
Commit Description:
add model solution
References:
File last commit:
Show/Diff file:
Action:
app/models/announcement.rb
| 15 lines
| 416 B
| text/x-ruby
| RubyLexer
|
|
r97 | class Announcement < ActiveRecord::Base | ||
|
r151 | |||
r619 | def self.published(contest_started=false) | |||
|
r162 | if contest_started | ||
r619 | where(published: true).where(frontpage: false).order(created_at: :desc) | |||
|
r162 | else | ||
r619 | where(published: true).where(frontpage: false).where(contest_only: false).order(created_at: :desc) | |||
|
r162 | end | ||
|
r151 | end | ||
r619 | def self.frontpage | |||
where(published: 1).where(frontpage: 1).order(created_at: :desc) | ||||
|
r151 | end | ||
|
r97 | end | ||