Added some models
User Item Department Categorie AssignmentLog Room
This commit is contained in:
11
app/models/room.rb
Normal file
11
app/models/room.rb
Normal file
@@ -0,0 +1,11 @@
|
||||
class Room < ApplicationRecord
|
||||
has_many :items, dependent: :nullify
|
||||
has_many :assignment_logs, dependent: :destroy
|
||||
|
||||
validates :name, presence: true, uniqueness: true
|
||||
|
||||
# Für das Raum-Auswahlfeld im Formular
|
||||
def name_with_building
|
||||
building.present? ? "#{name} (Gebäude #{building})" : name
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user