Sha256: 132c59d3ada8c0a56e8d381d16eccf1c8e18949639cc735b38476c43bcb8f9aa
Contents?: true
Size: 755 Bytes
Versions: 1
Compression:
Stored size: 755 Bytes
Contents
require 'active_model' module NCore module ActiveModel extend ActiveSupport::Concern included do include ::ActiveModel::Conversion extend ::ActiveModel::Translation alias :errors :errors_for_actionpack end if defined?(Rails) def logger Rails.logger end end def new_record? !id end def persisted? !new_record? end def destroy(*args) delete(*args) end # actionpack 4 requires a more robust Errors object def errors_for_actionpack e0 = ::ActiveModel::Errors.new(self) @errors.each do |e| e0.add :base, e end e0 end end Base.send :include, ActiveModel SingletonBase.send :include, ActiveModel end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ncore-1.0.0 | lib/ncore/rails/active_model.rb |