Sha256: e449bc38da8d9519c766a70e243127d2491f976e0fbc80c22f673e192a74f9c6
Contents?: true
Size: 871 Bytes
Versions: 1
Compression:
Stored size: 871 Bytes
Contents
class Restly::Associations::Base extend ActiveSupport::Autoload autoload :Loaders autoload :Stubs autoload :Builders autoload :Modifiers autoload :Conditionals include Loaders include Stubs include Builders include Modifiers include Conditionals attr_reader :name, :namespace, :polymorphic, :options def initialize(owner, name, options={}) @name = name @namespace = options.delete(:namespace) || owner.name.gsub(/(::)?\w+$/, '') @polymorphic = options.delete(:polymorphic) options[:class_name] ||= name.to_s.classify @owner = owner @options = options end def association_class [@namespace, options(:class_name)].select(&:present?).join('::').constantize end private def association_resource_name collection? ? association_class.resource_name.pluralize : association_class.resource_name end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restly-0.0.1.alpha.10 | lib/restly/associations/base.rb |