1resu 12 months ago
parent f5efc9af77
commit 97444ab902
  1. 3
      app/models/application_record.rb
  2. 2
      app/models/article.rb
  3. 2
      app/models/supplier.rb
  4. 2
      app/models/user.rb
  5. 2
      app/models/user_access.rb

@ -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…
Cancel
Save