class ArelConverter::Translator::Association

Public Instance Methods

post_processing(new_scope) click to toggle source
# File lib/arel_converter/translators/association.rb, line 33
def post_processing(new_scope)
  new_scope.gsub!(/has_(many|one|and_belongs_to_many)\((.*)\)$/, 'has_\1 \2')
  new_scope.gsub!(/belongs_to\((.*)\)$/, 'belongs_to \1')
  [new_scope, format_scope(@scopes), @options].compact.join(', ')
end
process_call(exp) click to toggle source
Calls superclass method
# File lib/arel_converter/translators/association.rb, line 5
def process_call(exp)
  @association_type ||= exp[1]
  super
end

Protected Instance Methods

format_scope(scopes) click to toggle source
# File lib/arel_converter/translators/association.rb, line 41
def format_scope(scopes)
  return nil if scopes.nil? || scopes.empty?
  "-> { #{scopes.strip} }" unless scopes.nil? || scopes.empty?
end
option_nodes() click to toggle source
# File lib/arel_converter/translators/association.rb, line 46
def option_nodes
  [
    s(:lit, :counter_cache),
    s(:lit, :polymorphic),
    s(:lit, :touch),
    s(:lit, :as),
    s(:lit, :autosave),
    s(:lit, :class_name),
    s(:lit, :dependent),
    s(:lit, :foreign_key),
    s(:lit, :inverse_of),
    s(:lit, :primary_key),
    s(:lit, :source),
    s(:lit, :source_type),
    s(:lit, :through),
    s(:lit, :validate),
    s(:lit, :association_foreign_key),
    s(:lit, :autosave),
    s(:lit, :join_table)
  ]
end