mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-28 19:56:11 +01:00
parent
556c68c2e6
commit
6014ce7a6f
4 changed files with 20 additions and 3 deletions
|
|
@ -14,6 +14,8 @@ class Project < ActiveRecord::Base
|
|||
scope :with_name_or_description, lambda { |body| where("name LIKE ? OR description LIKE ?", body, body) }
|
||||
scope :with_namepart, lambda { |body| where("name LIKE ?", body + '%') }
|
||||
|
||||
before_create :set_last_reviewed_now
|
||||
|
||||
validates_presence_of :name
|
||||
validates_length_of :name, :maximum => 255
|
||||
validates_uniqueness_of :name, :scope => "user_id"
|
||||
|
|
@ -47,6 +49,10 @@ class Project < ActiveRecord::Base
|
|||
NullProject.new
|
||||
end
|
||||
|
||||
def set_last_reviewed_now
|
||||
self.last_reviewed = Time.now
|
||||
end
|
||||
|
||||
def hide_todos
|
||||
todos.each do |t|
|
||||
unless t.completed? || t.deferred?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue