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/generators/simbiotes/create_model/create_model_generator.rb', line 8
def copy_model_file
if portal == "true"
@c = Simbiotes.get_attributes(parent, name)
end
@targets = Simbiotes::Portal.parse_all_interfaces
template "simbiotes_module.rb.erb", "app/models/#{module_file_name}.rb"
unless File.exist?("app/models/#{module_file_name}/#{module_file_name}.rb")
template "create_module_model_table.rb.erb", "db/migrate/#{date_string}_create_#{plural_name}.rb"
end
template "simbiotes_module_model.rb.erb", "app/models/#{module_file_name}/#{module_file_name}.rb"
template "simbiotes_model.rb.erb", "app/models/#{module_file_name}/#{file_name}.rb"
unless Simbiotes.configuration.local_logging == false
if portal == "true"
@c[:attributes].each do |k,v|
@k = k
@v = v
template "simbiotes_logs_model.rb.erb", "app/models/#{module_file_name}/#{file_name}_#{@k.underscore.downcase.gsub(" ","_")}_log.rb"
end
else
@k = name
template "simbiotes_logs_model.rb.erb", "app/models/#{module_file_name}/#{file_name}_#{@k.underscore.downcase.gsub(" ","_")}_log.rb"
end
end
end
|