module Cylons::ActiveRecordExtensions::ClassMethods

Public Instance Methods

reload_remotes!() click to toggle source
# File lib/cylons/active_record_extensions.rb, line 11
def reload_remotes!
  ::Cylons::RemoteDiscovery.load_remotes unless ::Cylons.silence?
end
remote_belongs_to(*args) click to toggle source
# File lib/cylons/active_record_extensions.rb, line 19
def remote_belongs_to(*args)
  options = args.extract_options!

  args.each do |arg|
    options[:foreign_key] = "#{arg}_id"
    association_hash = {:name => arg, :association_type => :belongs_to, :options => options}
    self.remote_associations << association_hash
    build_remote_belongs_to_association(association_hash)
  end
end
remote_has_many(*args) click to toggle source

store remote has many assoc globally, then define it locally.

# File lib/cylons/active_record_extensions.rb, line 31
def remote_has_many(*args)
  options = args.extract_options!

  args.each do |arg|
    association_hash = {:name => arg, :association_type => :has_many, :options => options}
    self.remote_associations << association_hash
    build_remote_has_many_association(association_hash)
  end
end
remote_schema() click to toggle source
# File lib/cylons/active_record_extensions.rb, line 15
def remote_schema
  ::Cylons::RemoteRegistry.get_remote_schema(self.name) unless ::Cylons.silence?
end