Convert to ApplicationRecord

Rails 5 requires the use of this superclass for all database backed
model objects now.
This commit is contained in:
Matt Rogers 2018-11-03 15:57:14 -05:00
parent 35e6384b95
commit 0e21d64890
No known key found for this signature in database
GPG key ID: 605D017C07EB4316
12 changed files with 14 additions and 11 deletions

View file

@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View file

@ -1,4 +1,4 @@
class Attachment < ActiveRecord::Base
class Attachment < ApplicationRecord
belongs_to :todo, touch: true
has_attached_file :file,

View 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

View file

@ -1,4 +1,4 @@
class Dependency < ActiveRecord::Base
class Dependency < ApplicationRecord
# touch to make sure todo caches for predecessor and successor are invalidated

View file

@ -1,4 +1,4 @@
class Note < ActiveRecord::Base
class Note < ApplicationRecord
belongs_to :user
belongs_to :project

View file

@ -1,4 +1,4 @@
class Preference < ActiveRecord::Base
class Preference < ApplicationRecord
belongs_to :user
belongs_to :sms_context, :class_name => 'Context'

View file

@ -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

View file

@ -1,4 +1,4 @@
class RecurringTodo < ActiveRecord::Base
class RecurringTodo < ApplicationRecord
belongs_to :context
belongs_to :project
belongs_to :user

View file

@ -1,4 +1,4 @@
class Tag < ActiveRecord::Base
class Tag < ApplicationRecord
has_many :taggings
has_many :taggable, :through => :taggings

View file

@ -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

View file

@ -1,4 +1,4 @@
class Todo < ActiveRecord::Base
class Todo < ApplicationRecord
MAX_DESCRIPTION_LENGTH = 300
MAX_NOTES_LENGTH = 60000

View file

@ -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