1
0
Fork 0
This repository has been archived on 2023-03-27. You can view files and clone it, but cannot push or open issues or pull requests.
lpr-partynest/app/models/application_record.rb

22 lines
506 B
Ruby
Raw Normal View History

2018-11-22 14:58:12 -05:00
# frozen_string_literal: true
2018-11-22 14:33:08 -05:00
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
2019-08-17 21:19:45 -04:00
def self.has_many(*args)
options = args.extract_options!
options[:dependent] ||= :restrict_with_exception
super(*args, options)
end
2019-08-17 21:19:45 -04:00
def self.has_one(*args)
options = args.extract_options!
options[:dependent] ||= :restrict_with_exception
super(*args, options)
end
2019-07-21 22:42:04 -04:00
def self.pg_enum(name, values)
enum name => values.map { |s| [s.to_sym, s.to_s] }.to_h
end
2018-11-22 14:33:08 -05:00
end