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
32
33
34
35
36
37
|
# File 'lib/generators/mappable/views/views_generator.rb', line 6
def copy_view_files
map_files = %w[
maps/_form
maps/edit
maps/index
maps/new
maps/show
]
mapping_files = %w[
mappings/_form
mappings/edit
mappings/index
mappings/new
mappings/show
]
files = mapping_files
files += map_files if name.blank?
files.each do |file|
from_path = "#{file}.html.erb"
path_parts = ["mappable"]
path_parts.push(name) unless name.blank? path_parts.push("#{file}.html.erb")
to_path = File.join('app/views', *path_parts)
copy_file from_path, to_path
end
end
|