Sha256: da93f18ed6fcdfedb3dd099148d31f47a05e2a6dd97bd5d16029069094096f44

Contents?: true

Size: 611 Bytes

Versions: 89

Compression:

Stored size: 611 Bytes

Contents

# When extending an ActiveRecord::Base model class, you can mix this module
# into the extending class to make it behave like it was the original one
# in terms of it's model_name identity.
#
# Note that you have to mix this in directly into the first class inheriting
# from your real model class.
module RailsOps::ModelMixins::ArExtension
  extend ActiveSupport::Concern

  included do
    class_attribute :extended_record_base_class
    self.extended_record_base_class = superclass
  end

  module ClassMethods
    def model_name
      (extended_record_base_class || superclass).model_name
    end
  end
end

Version data entries

89 entries across 89 versions & 1 rubygems

Version Path
rails_ops-1.5.8 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.5.7 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.5.6 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.5.5 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.5.4 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.5.0 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.8 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.7 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.6 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.5 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.4 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.3 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.2 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.0.17.1 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.1 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.4.0 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.3.0 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.2.3 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.2.2 lib/rails_ops/model_mixins/ar_extension.rb
rails_ops-1.2.1 lib/rails_ops/model_mixins/ar_extension.rb