Sha256: 5d8d01a6c47533ac88a9bf3dc11b3e330ffb159dcf73b052c9013603795aee06
Contents?: true
Size: 737 Bytes
Versions: 17
Compression:
Stored size: 737 Bytes
Contents
require 'active_record' module EacRailsUtils module Patches module ModelAttributeRequired def self.included(base) base.extend ClassMethods base.include InstanceMethods end module ClassMethods def column_required?(column) m = new m.validate m.errors.key?(column.to_sym) end end module InstanceMethods def attribute_required?(column) self.class.column_required?(column) end end end end end [::ActiveRecord::Base, ::ActiveModel::Model].each do |c| next if c.included_modules.include? ::EacRailsUtils::Patches::ModelAttributeRequired c.include ::EacRailsUtils::Patches::ModelAttributeRequired end
Version data entries
17 entries across 17 versions & 1 rubygems