Sha256: 4c98e0805572c80ae1c54f2232b68fa0acc7f93a865eb2d2c427571c41e67c38

Contents?: true

Size: 584 Bytes

Versions: 1

Compression:

Stored size: 584 Bytes

Contents

require 'sunrise/config/base'

module Sunrise
  module Config
    class Association < Base
    
      def resource_name
        @resource_name ||= (@config_options[:class_name] || name)
      end
    
      def model
        @model ||= Utils.lookup(resource_name.to_s.camelize)
      end
    
      # Compare relation by model_type
      def is_this?(model_type)
        name.to_s.downcase == model_type.to_s.downcase
      end

      def relation_name
        @relation_name ||= (@config_options[:relation_name] || abstract_model.model.model_name.plural)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sunrise-cms-0.5.2 lib/sunrise/config/association.rb