mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
Convert to ApplicationRecord
Rails 5 requires the use of this superclass for all database backed model objects now.
This commit is contained in:
parent
35e6384b95
commit
0e21d64890
12 changed files with 14 additions and 11 deletions
3
app/models/application_record.rb
Normal file
3
app/models/application_record.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Attachment < ActiveRecord::Base
|
||||
class Attachment < ApplicationRecord
|
||||
belongs_to :todo, touch: true
|
||||
|
||||
has_attached_file :file,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Context < ActiveRecord::Base
|
||||
class Context < ApplicationRecord
|
||||
|
||||
has_many :todos, -> { order("todos.due IS NULL, todos.due ASC, todos.created_at ASC").includes(:project) }, :dependent => :delete_all
|
||||
has_many :recurring_todos, :dependent => :delete_all
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Dependency < ActiveRecord::Base
|
||||
class Dependency < ApplicationRecord
|
||||
|
||||
# touch to make sure todo caches for predecessor and successor are invalidated
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Note < ActiveRecord::Base
|
||||
class Note < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :project
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Preference < ActiveRecord::Base
|
||||
class Preference < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :sms_context, :class_name => 'Context'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Project < ActiveRecord::Base
|
||||
class Project < ApplicationRecord
|
||||
has_many :todos, -> {order("todos.due IS NULL, todos.due ASC, todos.created_at ASC")}, dependent: :delete_all
|
||||
has_many :notes, -> {order "created_at DESC"}, dependent: :delete_all
|
||||
has_many :recurring_todos
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class RecurringTodo < ActiveRecord::Base
|
||||
class RecurringTodo < ApplicationRecord
|
||||
belongs_to :context
|
||||
belongs_to :project
|
||||
belongs_to :user
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Tag < ActiveRecord::Base
|
||||
class Tag < ApplicationRecord
|
||||
|
||||
has_many :taggings
|
||||
has_many :taggable, :through => :taggings
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
# The Tagging join model.
|
||||
|
||||
class Tagging < ActiveRecord::Base
|
||||
class Tagging < ApplicationRecord
|
||||
|
||||
belongs_to :tag
|
||||
belongs_to :taggable, :polymorphic => true, :touch => true
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Todo < ActiveRecord::Base
|
||||
class Todo < ApplicationRecord
|
||||
|
||||
MAX_DESCRIPTION_LENGTH = 300
|
||||
MAX_NOTES_LENGTH = 60000
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
require 'digest/sha1'
|
||||
require 'bcrypt'
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
# Virtual attribute for the unencrypted password
|
||||
attr_accessor :password
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue