Add ApplicationRecord as new superclass for app models
https://guides.rubyonrails.org/upgrading_ruby_on_rails.html#active-record-models-now-inherit-from-applicationrecord-by-default
This commit is contained in:
parent
f5efc9af77
commit
97444ab902
5 changed files with 7 additions and 4 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
|
|
@ -22,7 +22,7 @@
|
|||
# category :string(255)
|
||||
#
|
||||
|
||||
class Article < ActiveRecord::Base
|
||||
class Article < ApplicationRecord
|
||||
belongs_to :supplier
|
||||
|
||||
validates_numericality_of :price, :tax, :deposit, :unit_quantity
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class Supplier < ActiveRecord::Base
|
||||
class Supplier < ApplicationRecord
|
||||
has_many :articles, :dependent => :destroy
|
||||
has_many :user_accesses, :dependent => :destroy
|
||||
has_many :users, :through => :user_accesses
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class User < ActiveRecord::Base
|
||||
class User < ApplicationRecord
|
||||
|
||||
has_many :user_accesses, :dependent => :destroy
|
||||
has_many :suppliers, :through => :user_accesses
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class UserAccess < ActiveRecord::Base
|
||||
class UserAccess < ApplicationRecord
|
||||
belongs_to :user
|
||||
belongs_to :supplier
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue