Module: Yt::Associations

Extended by:
ActiveSupport::Autoload
Included in:
Base
Defined in:
lib/yt/associations.rb,
lib/yt/associations/videos.rb,
lib/yt/associations/ratings.rb,
lib/yt/associations/channels.rb,
lib/yt/associations/snippets.rb,
lib/yt/associations/statuses.rb,
lib/yt/associations/playlists.rb,
lib/yt/associations/user_infos.rb,
lib/yt/associations/annotations.rb,
lib/yt/associations/details_sets.rb,
lib/yt/associations/subscriptions.rb,
lib/yt/associations/playlist_items.rb

Defined Under Namespace

Modules: Annotations, Channels, DetailsSets, PlaylistItems, Playlists, Ratings, Snippets, Statuses, Subscriptions, UserInfos, Videos

Instance Method Summary collapse

Instance Method Details

#has_many(attributes, options = {}) ⇒ Object Also known as: has_one



25
26
27
28
29
# File 'lib/yt/associations.rb', line 25

def has_many(attributes, options = {})
  mod = attributes.to_s.sub(/.*\./, '').camelize
  include "Yt::Associations::#{mod.pluralize}".constantize
  delegate *options[:delegate], to: attributes if options[:delegate]
end