Sha256: 63a4718ae1af3b5d5728a89eb9a371c1b9583b6ae05a72e6b7d44a31062d2766

Contents?: true

Size: 865 Bytes

Versions: 38

Compression:

Stored size: 865 Bytes

Contents

module Her
  module Model
    # This module includes basic functionnality to Her::Model
    module Base
      extend ActiveSupport::Concern

      # Returns true if attribute_name is
      # * in resource attributes
      # * an association
      #
      # @private
      def has_key?(attribute_name)
        has_attribute?(attribute_name) ||
          has_association?(attribute_name)
      end

      # Returns
      # * the value of the attribute_name attribute if it's in orm data
      # * the resource/collection corrsponding to attribute_name if it's an association
      #
      # @private
      def [](attribute_name)
        get_attribute(attribute_name) ||
          get_association(attribute_name)
      end

      # @private
      def singularized_resource_name
        self.class.name.split('::').last.tableize.singularize
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
test_track_rails_client-7.1.2 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-7.1.1 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-7.0.0 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-6.0.0 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-5.0.1 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-5.0.0 vendor/gems/her/lib/her/model/base.rb
her-1.1.1 lib/her/model/base.rb
test_track_rails_client-4.0.2 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.1 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.rc3 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.rc2 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha35 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha34 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha33 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha32 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha31 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha30 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha29 vendor/gems/her/lib/her/model/base.rb
test_track_rails_client-4.0.0.alpha28 vendor/gems/her/lib/her/model/base.rb