Sha256: 2cb4ee4308321a90be8b53583e4e9a4de801f2b024e386c6b327501a8718a3ba
Contents?: true
Size: 539 Bytes
Versions: 11
Compression:
Stored size: 539 Bytes
Contents
module Para # Base class for all para-specific models. # class ApplicationRecord < ActiveRecord::Base self.abstract_class = true private # Adds the `optional: true` option to the belongs_to calls inside the provided block, # but only for Rails 5.1+ # def self.with_belongs_to_optional_option_if_needed(&block) if ActiveRecord::Associations::Builder::BelongsTo.valid_options({}).include?(:optional) with_options(optional: true, &block) else block.call end end end end
Version data entries
11 entries across 11 versions & 1 rubygems