upgrade(rails 5): add application record
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
class Analytics < ActiveRecord::Base
|
||||
class Analytics < ApplicationRecord
|
||||
scope :hits_by_ip, ->(ip,col="*") { select("#{col}").where(:ip_address => ip).order("id DESC")}
|
||||
|
||||
def self.count_by_col(col)
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
class ApplicationRecord < ActiveRecord::Base
|
||||
self.abstract_class = true
|
||||
end
|
||||
@@ -1,4 +1,4 @@
|
||||
class Benefits < ActiveRecord::Base
|
||||
class Benefits < ApplicationRecord
|
||||
|
||||
def self.save(file, backup=false)
|
||||
data_path = Rails.root.join("public", "data")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class KeyManagement < ActiveRecord::Base
|
||||
class KeyManagement < ApplicationRecord
|
||||
belongs_to :work_info
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Message < ActiveRecord::Base
|
||||
class Message < ApplicationRecord
|
||||
belongs_to :user
|
||||
validates_presence_of :creator_id, :receiver_id, :message
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class PaidTimeOff < ActiveRecord::Base
|
||||
class PaidTimeOff < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_many :schedule, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
class Pay < ActiveRecord::Base
|
||||
class Pay < ApplicationRecord
|
||||
# Associations
|
||||
belongs_to :user
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Performance < ActiveRecord::Base
|
||||
class Performance < ApplicationRecord
|
||||
belongs_to :user
|
||||
|
||||
def reviewer_name
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
class Retirement < ActiveRecord::Base
|
||||
class Retirement < ApplicationRecord
|
||||
belongs_to :user
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class Schedule < ActiveRecord::Base
|
||||
class Schedule < ApplicationRecord
|
||||
belongs_to :paid_time_off
|
||||
|
||||
validates_presence_of :date_begin, :date_end, :event_desc, :event_name, :event_type
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
require 'encryption'
|
||||
|
||||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
validates :password, :presence => true,
|
||||
:confirmation => true,
|
||||
:length => {:within => 6..40},
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class WorkInfo < ActiveRecord::Base
|
||||
class WorkInfo < ApplicationRecord
|
||||
belongs_to :user
|
||||
has_one :key_management, :foreign_key => :user_id, :primary_key => :user_id, :dependent => :destroy
|
||||
#before_save :encrypt_ssn
|
||||
|
||||
Reference in New Issue
Block a user