Sha256: f8286e6202bd77d03eb80133cf7e5d86b1f1850fd737e5b1591bbdfb297ca8cb

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

require 'active_record'
require "active_record_ignored_attributes/version"
require "active_record_ignored_attributes/inspect"
require "active_record_ignored_attributes/same_attributes_as"

module ActiveRecordIgnoredAttributes
  extend ActiveSupport::Concern

  included do
    # TODO: class_inheritable_accessor
    def self.ignored_attributes
      [:id, :created_at, :updated_at]
    end
  end

  def attributes_without_ignored_attributes
    attributes.except(*self.class.ignored_attributes.map(&:to_s))
  end
  
end

ActiveRecord::Base.class_eval do
  include ActiveRecordIgnoredAttributes
  include ActiveRecordIgnoredAttributes::SameAttributesAs
  include ActiveRecordIgnoredAttributes::Inspect
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_ignored_attributes-0.0.2 lib/active_record_ignored_attributes.rb
active_record_ignored_attributes-0.0.1 lib/active_record_ignored_attributes.rb