Adopt Rails 5 belongs_to_required_by_default
This commit is contained in:
parent
2557645f4f
commit
44a198c7bc
23 changed files with 53 additions and 38 deletions
|
|
@ -1,5 +1,5 @@
|
|||
class Link < ApplicationRecord
|
||||
belongs_to :workgroup
|
||||
belongs_to :workgroup, optional: true
|
||||
|
||||
validates_presence_of :name, :url
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
require "base32"
|
||||
|
||||
class Message < ApplicationRecord
|
||||
belongs_to :sender, :class_name => "User", :foreign_key => "sender_id"
|
||||
belongs_to :group, :class_name => "Group", :foreign_key => "group_id"
|
||||
belongs_to :reply_to_message, :class_name => "Message", :foreign_key => "reply_to"
|
||||
belongs_to :sender, class_name: 'User', foreign_key: 'sender_id'
|
||||
belongs_to :group, optional: true, class_name: 'Group', foreign_key: 'group_id'
|
||||
belongs_to :reply_to_message, optional: true, class_name: 'Message', foreign_key: 'reply_to'
|
||||
has_many :message_recipients, dependent: :destroy
|
||||
has_many :recipients, through: :message_recipients, source: :user
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class PollVote < ActiveRecord::Base
|
||||
belongs_to :poll
|
||||
belongs_to :ordergroup
|
||||
belongs_to :ordergroup, optional: true
|
||||
belongs_to :user
|
||||
has_many :poll_choices, dependent: :destroy
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class PrinterJob < ActiveRecord::Base
|
|||
|
||||
belongs_to :order
|
||||
belongs_to :created_by, class_name: 'User', foreign_key: 'created_by_user_id'
|
||||
belongs_to :finished_by, class_name: 'User', foreign_key: 'finished_by_user_id'
|
||||
belongs_to :finished_by, optional: true, class_name: 'User', foreign_key: 'finished_by_user_id'
|
||||
has_many :printer_job_updates
|
||||
|
||||
scope :finished, -> { where.not(finished_at: nil) }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue