22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/forge/app/models/country.rb', line 22
def province_options_for_select(options = {})
display = options[:display] || "title"
add_blank = options[:add_blank] || false
text_for_blank = options[:text_for_blank] || "All"
case display
when "title"
provinces = self.provinces.all.collect { |p| [p.title, p.id] }
when "code"
provinces = self.provinces.all.collect { |p| [p.code, p.id] }
end
if add_blank
provinces.insert(0, [text_for_blank, 0])
end
provinces
end
|