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
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/generators/przelewy24/przelewy24_generator.rb', line 7
def generate_files
views.each do |view|
template "views/#{view}.html.erb", "app/views/#{plural_name}/#{view}.html.erb"
end
copy_file "przelewy24.yml", "config/locales/przelewy24.yml"
template 'controller.rb', "app/controllers/#{plural_name}_controller.rb"
template 'helper.rb', "app/helpers/#{plural_name}_helper.rb"
template 'model.rb', "app/models/#{singular_name}.rb"
routes_string=<<FINITO
resources :#{plural_name} do
collection do
get 'confirm'
get 'error'
post 'ok'
end
end
FINITO
route(routes_string)
if options.migration?
migration_file_name = "#{Time.now.utc.strftime("%Y%m%d")}_create_#{table_name}"
template 'migration.rb', "db/migrate/#{migration_file_name}.rb"
rake("db:migrate", :env => :development)
end
end
|