Class: Geert::Association

Inherits:
Object
  • Object
show all
Defined in:
lib/geert/association.rb

Instance Method Summary collapse

Instance Method Details

#columnObject



18
19
20
# File 'lib/geert/association.rb', line 18

def column
  reflection.primary_key_name
end

#exclude?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/geert/association.rb', line 26

def exclude?
  existing? or polymorphic? or uses_polymorphic?
end

#migrationObject



6
7
8
# File 'lib/geert/association.rb', line 6

def migration
  ":#{source}, :#{target}#{options_string}" unless exclude?
end

#outputObject



10
11
12
# File 'lib/geert/association.rb', line 10

def output
  "  :" + target + options_string unless exclude?
end

#polymorphic?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/geert/association.rb', line 14

def polymorphic?
  reflection.options[:polymorphic]
end

#targetObject



22
23
24
# File 'lib/geert/association.rb', line 22

def target
  reflection.table_name
end