4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/upmin/data_mapper/association.rb', line 4
def type
return @type if defined?(@type)
if relationship
if relationship.is_a?(DataMapper::Associations::ManyToOne::Relationship)
@type = relationship.parent_model_name
else
@type = relationship.child_model_name
end
@type = @type.underscore
if collection?
@type = @type.pluralize.to_sym
else
@type = @type.to_sym
end
else
@type = :unknown
end
if @type == :unknown
@type = infer_type_from_value
end
return @type
end
|