railties 5.2.0 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +293 -89
- data/MIT-LICENSE +1 -1
- data/RDOC_MAIN.rdoc +39 -33
- data/README.rdoc +3 -3
- data/lib/minitest/rails_plugin.rb +24 -13
- data/lib/rails/all.rb +4 -0
- data/lib/rails/api/generator.rb +2 -1
- data/lib/rails/api/task.rb +17 -0
- data/lib/rails/app_loader.rb +2 -2
- data/lib/rails/app_updater.rb +4 -1
- data/lib/rails/application/bootstrap.rb +9 -17
- data/lib/rails/application/configuration.rb +177 -27
- data/lib/rails/application/default_middleware_stack.rb +7 -3
- data/lib/rails/application/dummy_erb_compiler.rb +18 -0
- data/lib/rails/application/finisher.rb +69 -2
- data/lib/rails/application/routes_reloader.rb +9 -19
- data/lib/rails/application.rb +96 -66
- data/lib/rails/application_controller.rb +0 -1
- data/lib/rails/autoloaders.rb +48 -0
- data/lib/rails/backtrace_cleaner.rb +14 -21
- data/lib/rails/code_statistics.rb +8 -6
- data/lib/rails/code_statistics_calculator.rb +6 -6
- data/lib/rails/command/actions.rb +10 -0
- data/lib/rails/command/base.rb +17 -5
- data/lib/rails/command/behavior.rb +8 -49
- data/lib/rails/command/environment_argument.rb +9 -16
- data/lib/rails/command/spellchecker.rb +57 -0
- data/lib/rails/command.rb +18 -11
- data/lib/rails/commands/console/console_command.rb +6 -0
- data/lib/rails/commands/credentials/USAGE +33 -0
- data/lib/rails/commands/credentials/credentials_command/diffing.rb +41 -0
- data/lib/rails/commands/credentials/credentials_command.rb +78 -21
- data/lib/rails/commands/db/system/change/change_command.rb +25 -0
- data/lib/rails/commands/dbconsole/dbconsole_command.rb +66 -51
- data/lib/rails/commands/dev/dev_command.rb +19 -0
- data/lib/rails/commands/encrypted/USAGE +28 -0
- data/lib/rails/commands/encrypted/encrypted_command.rb +5 -4
- data/lib/rails/commands/generate/generate_command.rb +1 -1
- data/lib/rails/commands/help/help_command.rb +1 -1
- data/lib/rails/commands/initializers/initializers_command.rb +23 -0
- data/lib/rails/commands/new/new_command.rb +2 -2
- data/lib/rails/commands/notes/notes_command.rb +29 -0
- data/lib/rails/commands/plugin/plugin_command.rb +1 -1
- data/lib/rails/commands/rake/rake_command.rb +9 -8
- data/lib/rails/commands/routes/routes_command.rb +37 -0
- data/lib/rails/commands/runner/runner_command.rb +13 -9
- data/lib/rails/commands/secrets/USAGE +6 -0
- data/lib/rails/commands/secrets/secrets_command.rb +3 -3
- data/lib/rails/commands/server/server_command.rb +92 -56
- data/lib/rails/commands/test/test_command.rb +2 -2
- data/lib/rails/configuration.rb +48 -19
- data/lib/rails/engine/configuration.rb +6 -2
- data/lib/rails/engine/updater.rb +1 -1
- data/lib/rails/engine.rb +63 -35
- data/lib/rails/gem_version.rb +2 -2
- data/lib/rails/generators/actions/create_migration.rb +5 -1
- data/lib/rails/generators/actions.rb +89 -56
- data/lib/rails/generators/app_base.rb +80 -108
- data/lib/rails/generators/app_name.rb +50 -0
- data/lib/rails/generators/base.rb +19 -12
- data/lib/rails/generators/database.rb +57 -0
- data/lib/rails/generators/erb/mailer/mailer_generator.rb +1 -2
- data/lib/rails/generators/erb/scaffold/scaffold_generator.rb +0 -1
- data/lib/rails/generators/erb/scaffold/templates/_form.html.erb.tt +7 -4
- data/lib/rails/generators/erb/scaffold/templates/index.html.erb.tt +1 -1
- data/lib/rails/generators/erb/scaffold/templates/show.html.erb.tt +9 -1
- data/lib/rails/generators/erb.rb +0 -1
- data/lib/rails/generators/generated_attribute.rb +50 -31
- data/lib/rails/generators/migration.rb +3 -3
- data/lib/rails/generators/model_helpers.rb +33 -2
- data/lib/rails/generators/named_base.rb +3 -7
- data/lib/rails/generators/rails/app/USAGE +2 -1
- data/lib/rails/generators/rails/app/app_generator.rb +127 -84
- data/lib/rails/generators/rails/app/templates/Gemfile.tt +18 -21
- data/lib/rails/generators/rails/app/templates/Rakefile.tt +1 -1
- data/lib/rails/generators/rails/app/templates/app/assets/config/manifest.js.tt +0 -3
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/consumer.js +6 -0
- data/lib/rails/generators/rails/app/templates/app/javascript/channels/index.js +5 -0
- data/lib/rails/generators/rails/app/templates/app/javascript/packs/application.js.tt +23 -0
- data/lib/rails/generators/rails/app/templates/app/jobs/application_job.rb.tt +5 -0
- data/lib/rails/generators/rails/app/templates/app/views/layouts/application.html.erb.tt +6 -5
- data/lib/rails/generators/rails/app/templates/bin/rails.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/rake.tt +5 -2
- data/lib/rails/generators/rails/app/templates/bin/setup.tt +9 -9
- data/lib/rails/generators/rails/app/templates/bin/spring.tt +9 -0
- data/lib/rails/generators/rails/app/templates/bin/yarn.tt +11 -3
- data/lib/rails/generators/rails/app/templates/config/application.rb.tt +16 -7
- data/lib/rails/generators/rails/app/templates/config/boot.rb.tt +2 -2
- data/lib/rails/generators/rails/app/templates/config/cable.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/jdbc.yml.tt +4 -5
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcpostgresql.yml.tt +13 -12
- data/lib/rails/generators/rails/app/templates/config/databases/jdbcsqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/mysql.yml.tt +13 -12
- data/lib/rails/generators/rails/app/templates/config/databases/oracle.yml.tt +12 -11
- data/lib/rails/generators/rails/app/templates/config/databases/postgresql.yml.tt +16 -15
- data/lib/rails/generators/rails/app/templates/config/databases/sqlite3.yml.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/databases/sqlserver.yml.tt +11 -10
- data/lib/rails/generators/rails/app/templates/config/environment.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/environments/development.rb.tt +22 -5
- data/lib/rails/generators/rails/app/templates/config/environments/production.rb.tt +43 -17
- data/lib/rails/generators/rails/app/templates/config/environments/test.rb.tt +26 -7
- data/lib/rails/generators/rails/app/templates/config/initializers/assets.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/backtrace_silencers.rb.tt +4 -3
- data/lib/rails/generators/rails/app/templates/config/initializers/content_security_policy.rb.tt +7 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/filter_parameter_logging.rb.tt +3 -1
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_6_1.rb.tt +63 -0
- data/lib/rails/generators/rails/app/templates/config/initializers/permissions_policy.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/config/locales/en.yml +1 -1
- data/lib/rails/generators/rails/app/templates/config/puma.rb.tt +13 -4
- data/lib/rails/generators/rails/app/templates/config/routes.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/config/spring.rb.tt +6 -6
- data/lib/rails/generators/rails/app/templates/config.ru.tt +2 -1
- data/lib/rails/generators/rails/app/templates/db/seeds.rb.tt +1 -1
- data/lib/rails/generators/rails/app/templates/gitattributes.tt +14 -0
- data/lib/rails/generators/rails/app/templates/gitignore.tt +10 -7
- data/lib/rails/generators/rails/app/templates/package.json.tt +8 -2
- data/lib/rails/generators/rails/app/templates/public/robots.txt +1 -1
- data/lib/rails/generators/rails/app/templates/ruby-version.tt +1 -1
- data/lib/rails/generators/rails/app/templates/test/channels/application_cable/connection_test.rb.tt +11 -0
- data/lib/rails/generators/rails/app/templates/test/test_helper.rb.tt +9 -2
- data/lib/rails/generators/rails/assets/USAGE +3 -7
- data/lib/rails/generators/rails/assets/assets_generator.rb +0 -1
- data/lib/rails/generators/rails/benchmark/USAGE +19 -0
- data/lib/rails/generators/rails/benchmark/benchmark_generator.rb +29 -0
- data/lib/rails/generators/rails/benchmark/templates/benchmark.rb.tt +15 -0
- data/lib/rails/generators/rails/controller/USAGE +2 -2
- data/lib/rails/generators/rails/controller/controller_generator.rb +10 -39
- data/lib/rails/generators/rails/credentials/credentials_generator.rb +6 -7
- data/lib/rails/generators/rails/db/system/change/change_generator.rb +65 -0
- data/lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb +10 -7
- data/lib/rails/generators/rails/encryption_key_file/encryption_key_file_generator.rb +1 -0
- data/lib/rails/generators/rails/generator/USAGE +2 -2
- data/lib/rails/generators/rails/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/rails/generator/templates/USAGE.tt +1 -1
- data/lib/rails/generators/rails/helper/USAGE +2 -3
- data/lib/rails/generators/rails/helper/helper_generator.rb +5 -0
- data/lib/rails/generators/rails/integration_test/USAGE +2 -2
- data/lib/rails/generators/rails/migration/USAGE +4 -4
- data/lib/rails/generators/rails/model/USAGE +15 -16
- data/lib/rails/generators/rails/plugin/plugin_generator.rb +32 -56
- data/lib/rails/generators/rails/plugin/templates/%name%.gemspec.tt +18 -18
- data/lib/rails/generators/rails/plugin/templates/Gemfile.tt +3 -10
- data/lib/rails/generators/rails/plugin/templates/Rakefile.tt +4 -18
- data/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt +1 -2
- data/lib/rails/generators/rails/plugin/templates/app/helpers/%namespaced_name%/application_helper.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/jobs/%namespaced_name%/application_job.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/mailers/%namespaced_name%/application_mailer.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/app/models/%namespaced_name%/application_record.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/bin/rails.tt +3 -3
- data/lib/rails/generators/rails/plugin/templates/gitignore.tt +14 -11
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/engine.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%/railtie.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/lib/%namespaced_name%.rb.tt +1 -0
- data/lib/rails/generators/rails/plugin/templates/rails/boot.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/%namespaced_name%_test.rb.tt +4 -4
- data/lib/rails/generators/rails/plugin/templates/test/integration/navigation_test.rb.tt +1 -1
- data/lib/rails/generators/rails/plugin/templates/test/test_helper.rb.tt +0 -4
- data/lib/rails/generators/rails/resource/USAGE +4 -4
- data/lib/rails/generators/rails/resource_route/resource_route_generator.rb +2 -27
- data/lib/rails/generators/rails/scaffold/USAGE +5 -5
- data/lib/rails/generators/rails/scaffold_controller/USAGE +2 -2
- data/lib/rails/generators/rails/scaffold_controller/scaffold_controller_generator.rb +19 -0
- data/lib/rails/generators/rails/scaffold_controller/templates/api_controller.rb.tt +2 -2
- data/lib/rails/generators/rails/scaffold_controller/templates/controller.rb.tt +2 -2
- data/lib/rails/generators/rails/system_test/USAGE +2 -2
- data/lib/rails/generators/rails/task/USAGE +3 -3
- data/lib/rails/generators/resource_helpers.rb +1 -6
- data/lib/rails/generators/test_case.rb +1 -1
- data/lib/rails/generators/test_unit/controller/controller_generator.rb +2 -0
- data/lib/rails/generators/test_unit/controller/templates/functional_test.rb.tt +3 -3
- data/lib/rails/generators/test_unit/generator/generator_generator.rb +0 -1
- data/lib/rails/generators/test_unit/generator/templates/generator_test.rb.tt +2 -2
- data/lib/rails/generators/test_unit/integration/integration_generator.rb +5 -0
- data/lib/rails/generators/test_unit/integration/templates/integration_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/job/job_generator.rb +5 -0
- data/lib/rails/generators/test_unit/job/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/mailer/mailer_generator.rb +1 -1
- data/lib/rails/generators/test_unit/mailer/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/model/templates/fixtures.yml.tt +3 -3
- data/lib/rails/generators/test_unit/model/templates/unit_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/%file_name%_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/plugin/templates/test_helper.rb +2 -2
- data/lib/rails/generators/test_unit/scaffold/scaffold_generator.rb +12 -3
- data/lib/rails/generators/test_unit/scaffold/templates/api_functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/functional_test.rb.tt +1 -1
- data/lib/rails/generators/test_unit/scaffold/templates/system_test.rb.tt +10 -2
- data/lib/rails/generators/test_unit/system/system_generator.rb +5 -0
- data/lib/rails/generators/testing/assertions.rb +2 -2
- data/lib/rails/generators/testing/behaviour.rb +4 -2
- data/lib/rails/generators.rb +38 -24
- data/lib/rails/info.rb +4 -4
- data/lib/rails/info_controller.rb +2 -3
- data/lib/rails/mailers_controller.rb +10 -4
- data/lib/rails/paths.rb +26 -10
- data/lib/rails/rack/logger.rb +5 -6
- data/lib/rails/railtie/configurable.rb +0 -1
- data/lib/rails/railtie/configuration.rb +3 -3
- data/lib/rails/railtie.rb +33 -13
- data/lib/rails/ruby_version_check.rb +3 -3
- data/lib/rails/secrets.rb +0 -1
- data/lib/rails/source_annotation_extractor.rb +124 -117
- data/lib/rails/tasks/engine.rake +1 -4
- data/lib/rails/tasks/framework.rake +13 -3
- data/lib/rails/tasks/log.rake +0 -1
- data/lib/rails/tasks/misc.rake +1 -1
- data/lib/rails/tasks/statistics.rake +5 -1
- data/lib/rails/tasks/yarn.rake +14 -1
- data/lib/rails/tasks/zeitwerk.rake +69 -0
- data/lib/rails/tasks.rb +1 -4
- data/lib/rails/templates/rails/mailers/email.html.erb +11 -7
- data/lib/rails/templates/rails/welcome/index.html.erb +3 -3
- data/lib/rails/test_help.rb +11 -9
- data/lib/rails/test_unit/reporter.rb +3 -2
- data/lib/rails/test_unit/runner.rb +25 -8
- data/lib/rails/test_unit/testing.rake +7 -1
- data/lib/rails.rb +10 -8
- metadata +45 -39
- data/lib/rails/generators/js/assets/assets_generator.rb +0 -15
- data/lib/rails/generators/js/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/application.js.tt +0 -22
- data/lib/rails/generators/rails/app/templates/app/assets/javascripts/cable.js.tt +0 -13
- data/lib/rails/generators/rails/app/templates/bin/bundle.tt +0 -2
- data/lib/rails/generators/rails/app/templates/bin/update.tt +0 -34
- data/lib/rails/generators/rails/app/templates/config/databases/frontbase.yml.tt +0 -50
- data/lib/rails/generators/rails/app/templates/config/databases/ibm_db.yml.tt +0 -86
- data/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults_5_2.rb.tt +0 -35
- data/lib/rails/generators/rails/assets/templates/javascript.js +0 -2
- data/lib/rails/generators/rails/plugin/templates/rails/application.rb.tt +0 -23
- data/lib/rails/tasks/annotations.rake +0 -22
- data/lib/rails/tasks/dev.rake +0 -10
- data/lib/rails/tasks/initializers.rake +0 -8
- data/lib/rails/tasks/routes.rake +0 -31
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require "fileutils"
|
4
4
|
require "digest/md5"
|
5
|
-
require "active_support/core_ext/string/strip"
|
6
5
|
require "rails/version" unless defined?(Rails::VERSION)
|
7
6
|
require "open-uri"
|
8
7
|
require "uri"
|
@@ -12,9 +11,8 @@ require "active_support/core_ext/array/extract_options"
|
|
12
11
|
module Rails
|
13
12
|
module Generators
|
14
13
|
class AppBase < Base # :nodoc:
|
15
|
-
|
16
|
-
|
17
|
-
DATABASES.concat(JDBC_DATABASES)
|
14
|
+
include Database
|
15
|
+
include AppName
|
18
16
|
|
19
17
|
attr_accessor :rails_template
|
20
18
|
add_shebang_option!
|
@@ -32,9 +30,6 @@ module Rails
|
|
32
30
|
class_option :database, type: :string, aliases: "-d", default: "sqlite3",
|
33
31
|
desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
|
34
32
|
|
35
|
-
class_option :skip_yarn, type: :boolean, default: false,
|
36
|
-
desc: "Don't use Yarn for managing JavaScript dependencies"
|
37
|
-
|
38
33
|
class_option :skip_gemfile, type: :boolean, default: false,
|
39
34
|
desc: "Don't create a Gemfile"
|
40
35
|
|
@@ -48,9 +43,18 @@ module Rails
|
|
48
43
|
default: false,
|
49
44
|
desc: "Skip Action Mailer files"
|
50
45
|
|
46
|
+
class_option :skip_action_mailbox, type: :boolean, default: false,
|
47
|
+
desc: "Skip Action Mailbox gem"
|
48
|
+
|
49
|
+
class_option :skip_action_text, type: :boolean, default: false,
|
50
|
+
desc: "Skip Action Text gem"
|
51
|
+
|
51
52
|
class_option :skip_active_record, type: :boolean, aliases: "-O", default: false,
|
52
53
|
desc: "Skip Active Record files"
|
53
54
|
|
55
|
+
class_option :skip_active_job, type: :boolean, default: false,
|
56
|
+
desc: "Skip Active Job"
|
57
|
+
|
54
58
|
class_option :skip_active_storage, type: :boolean, default: false,
|
55
59
|
desc: "Skip Active Storage files"
|
56
60
|
|
@@ -69,15 +73,15 @@ module Rails
|
|
69
73
|
class_option :skip_listen, type: :boolean, default: false,
|
70
74
|
desc: "Don't generate configuration that depends on the listen gem"
|
71
75
|
|
72
|
-
class_option :
|
73
|
-
desc: "Don't use CoffeeScript"
|
74
|
-
|
75
|
-
class_option :skip_javascript, type: :boolean, aliases: "-J", default: false,
|
76
|
+
class_option :skip_javascript, type: :boolean, aliases: "-J", default: name == "plugin",
|
76
77
|
desc: "Skip JavaScript files"
|
77
78
|
|
78
79
|
class_option :skip_turbolinks, type: :boolean, default: false,
|
79
80
|
desc: "Skip turbolinks gem"
|
80
81
|
|
82
|
+
class_option :skip_jbuilder, type: :boolean, default: false,
|
83
|
+
desc: "Skip jbuilder gem"
|
84
|
+
|
81
85
|
class_option :skip_test, type: :boolean, aliases: "-T", default: false,
|
82
86
|
desc: "Skip test files"
|
83
87
|
|
@@ -88,10 +92,13 @@ module Rails
|
|
88
92
|
desc: "Skip bootsnap gem"
|
89
93
|
|
90
94
|
class_option :dev, type: :boolean, default: false,
|
91
|
-
desc: "
|
95
|
+
desc: "Set up the #{name} with Gemfile pointing to your Rails checkout"
|
92
96
|
|
93
97
|
class_option :edge, type: :boolean, default: false,
|
94
|
-
desc: "
|
98
|
+
desc: "Set up the #{name} with Gemfile pointing to Rails repository"
|
99
|
+
|
100
|
+
class_option :master, type: :boolean, default: false,
|
101
|
+
desc: "Set up the #{name} with Gemfile pointing to Rails repository master branch"
|
95
102
|
|
96
103
|
class_option :rc, type: :string, default: nil,
|
97
104
|
desc: "Path to file containing extra configuration options for rails command"
|
@@ -107,11 +114,9 @@ module Rails
|
|
107
114
|
@gem_filter = lambda { |gem| true }
|
108
115
|
@extra_entries = []
|
109
116
|
super
|
110
|
-
convert_database_option_for_jruby
|
111
117
|
end
|
112
118
|
|
113
119
|
private
|
114
|
-
|
115
120
|
def gemfile_entry(name, *args) # :doc:
|
116
121
|
options = args.extract_options!
|
117
122
|
version = args.first
|
@@ -131,7 +136,7 @@ module Rails
|
|
131
136
|
def gemfile_entries # :doc:
|
132
137
|
[rails_gemfile_entry,
|
133
138
|
database_gemfile_entry,
|
134
|
-
|
139
|
+
web_server_gemfile_entry,
|
135
140
|
assets_gemfile_entry,
|
136
141
|
webpacker_gemfile_entry,
|
137
142
|
javascript_gemfile_entry,
|
@@ -156,7 +161,7 @@ module Rails
|
|
156
161
|
end
|
157
162
|
|
158
163
|
def build(meth, *args) # :doc:
|
159
|
-
builder.
|
164
|
+
builder.public_send(meth, *args) if builder.respond_to?(meth)
|
160
165
|
end
|
161
166
|
|
162
167
|
def create_root # :doc:
|
@@ -192,10 +197,10 @@ module Rails
|
|
192
197
|
"Use #{options[:database]} as the database for Active Record"
|
193
198
|
end
|
194
199
|
|
195
|
-
def
|
200
|
+
def web_server_gemfile_entry # :doc:
|
196
201
|
return [] if options[:skip_puma]
|
197
202
|
comment = "Use Puma as the app server"
|
198
|
-
GemfileEntry.new("puma", "~>
|
203
|
+
GemfileEntry.new("puma", "~> 5.0", comment)
|
199
204
|
end
|
200
205
|
|
201
206
|
def include_all_railties? # :doc:
|
@@ -205,9 +210,12 @@ module Rails
|
|
205
210
|
:skip_action_mailer,
|
206
211
|
:skip_test,
|
207
212
|
:skip_sprockets,
|
208
|
-
:skip_action_cable
|
213
|
+
:skip_action_cable,
|
214
|
+
:skip_active_job
|
209
215
|
),
|
210
|
-
skip_active_storage
|
216
|
+
skip_active_storage?,
|
217
|
+
skip_action_mailbox?,
|
218
|
+
skip_action_text?
|
211
219
|
].flatten.none?
|
212
220
|
end
|
213
221
|
|
@@ -236,6 +244,18 @@ module Rails
|
|
236
244
|
options[:skip_active_storage] || options[:skip_active_record]
|
237
245
|
end
|
238
246
|
|
247
|
+
def skip_action_mailbox? # :doc:
|
248
|
+
options[:skip_action_mailbox] || skip_active_storage?
|
249
|
+
end
|
250
|
+
|
251
|
+
def skip_action_text? # :doc:
|
252
|
+
options[:skip_action_text] || skip_active_storage?
|
253
|
+
end
|
254
|
+
|
255
|
+
def skip_dev_gems? # :doc:
|
256
|
+
options[:skip_dev_gems]
|
257
|
+
end
|
258
|
+
|
239
259
|
class GemfileEntry < Struct.new(:name, :version, :comment, :options, :commented_out)
|
240
260
|
def initialize(name, version, comment, options = {}, commented_out = false)
|
241
261
|
super
|
@@ -275,7 +295,11 @@ module Rails
|
|
275
295
|
]
|
276
296
|
elsif options.edge?
|
277
297
|
[
|
278
|
-
GemfileEntry.github("rails", "rails/rails"
|
298
|
+
GemfileEntry.github("rails", "rails/rails")
|
299
|
+
]
|
300
|
+
elsif options.master?
|
301
|
+
[
|
302
|
+
GemfileEntry.github("rails", "rails/rails", "master")
|
279
303
|
]
|
280
304
|
else
|
281
305
|
[GemfileEntry.version("rails",
|
@@ -297,90 +321,30 @@ module Rails
|
|
297
321
|
end
|
298
322
|
end
|
299
323
|
|
300
|
-
def gem_for_database
|
301
|
-
# %w( mysql postgresql sqlite3 oracle frontbase ibm_db sqlserver jdbcmysql jdbcsqlite3 jdbcpostgresql )
|
302
|
-
case options[:database]
|
303
|
-
when "mysql" then ["mysql2", [">= 0.4.4", "< 0.6.0"]]
|
304
|
-
when "postgresql" then ["pg", [">= 0.18", "< 2.0"]]
|
305
|
-
when "oracle" then ["activerecord-oracle_enhanced-adapter", nil]
|
306
|
-
when "frontbase" then ["ruby-frontbase", nil]
|
307
|
-
when "sqlserver" then ["activerecord-sqlserver-adapter", nil]
|
308
|
-
when "jdbcmysql" then ["activerecord-jdbcmysql-adapter", nil]
|
309
|
-
when "jdbcsqlite3" then ["activerecord-jdbcsqlite3-adapter", nil]
|
310
|
-
when "jdbcpostgresql" then ["activerecord-jdbcpostgresql-adapter", nil]
|
311
|
-
when "jdbc" then ["activerecord-jdbc-adapter", nil]
|
312
|
-
else [options[:database], nil]
|
313
|
-
end
|
314
|
-
end
|
315
|
-
|
316
|
-
def convert_database_option_for_jruby
|
317
|
-
if defined?(JRUBY_VERSION)
|
318
|
-
opt = options.dup
|
319
|
-
case opt[:database]
|
320
|
-
when "postgresql" then opt[:database] = "jdbcpostgresql"
|
321
|
-
when "mysql" then opt[:database] = "jdbcmysql"
|
322
|
-
when "sqlite3" then opt[:database] = "jdbcsqlite3"
|
323
|
-
end
|
324
|
-
self.options = opt.freeze
|
325
|
-
end
|
326
|
-
end
|
327
|
-
|
328
324
|
def assets_gemfile_entry
|
329
325
|
return [] if options[:skip_sprockets]
|
330
326
|
|
331
|
-
|
332
|
-
gems << GemfileEntry.version("sass-rails", "~> 5.0",
|
333
|
-
"Use SCSS for stylesheets")
|
334
|
-
|
335
|
-
if !options[:skip_javascript]
|
336
|
-
gems << GemfileEntry.version("uglifier",
|
337
|
-
">= 1.3.0",
|
338
|
-
"Use Uglifier as compressor for JavaScript assets")
|
339
|
-
end
|
340
|
-
|
341
|
-
gems
|
327
|
+
GemfileEntry.version("sass-rails", ">= 6", "Use SCSS for stylesheets")
|
342
328
|
end
|
343
329
|
|
344
330
|
def webpacker_gemfile_entry
|
345
|
-
return []
|
331
|
+
return [] if options[:skip_javascript]
|
346
332
|
|
347
|
-
|
348
|
-
GemfileEntry.new "webpacker", nil, comment
|
333
|
+
GemfileEntry.version "webpacker", "~> 5.0", "Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker"
|
349
334
|
end
|
350
335
|
|
351
336
|
def jbuilder_gemfile_entry
|
337
|
+
return [] if options[:skip_jbuilder]
|
352
338
|
comment = "Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder"
|
353
|
-
GemfileEntry.new "jbuilder", "~> 2.
|
354
|
-
end
|
355
|
-
|
356
|
-
def coffee_gemfile_entry
|
357
|
-
GemfileEntry.version "coffee-rails", "~> 4.2", "Use CoffeeScript for .coffee assets and views"
|
339
|
+
GemfileEntry.new "jbuilder", "~> 2.7", comment, {}, options[:api]
|
358
340
|
end
|
359
341
|
|
360
342
|
def javascript_gemfile_entry
|
361
|
-
if options[:skip_javascript] || options[:
|
343
|
+
if options[:skip_javascript] || options[:skip_turbolinks]
|
362
344
|
[]
|
363
345
|
else
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
unless options[:skip_turbolinks]
|
368
|
-
gems << GemfileEntry.version("turbolinks", "~> 5",
|
369
|
-
"Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks")
|
370
|
-
end
|
371
|
-
|
372
|
-
gems
|
373
|
-
end
|
374
|
-
end
|
375
|
-
|
376
|
-
def javascript_runtime_gemfile_entry
|
377
|
-
comment = "See https://github.com/rails/execjs#readme for more supported runtimes"
|
378
|
-
if defined?(JRUBY_VERSION)
|
379
|
-
GemfileEntry.version "therubyrhino", nil, comment
|
380
|
-
elsif RUBY_PLATFORM =~ /mingw|mswin/
|
381
|
-
GemfileEntry.version "duktape", nil, comment
|
382
|
-
else
|
383
|
-
GemfileEntry.new "mini_racer", nil, comment, { platforms: :ruby }, true
|
346
|
+
[ GemfileEntry.version("turbolinks", "~> 5",
|
347
|
+
"Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks") ]
|
384
348
|
end
|
385
349
|
end
|
386
350
|
|
@@ -400,7 +364,7 @@ module Rails
|
|
400
364
|
gems
|
401
365
|
end
|
402
366
|
|
403
|
-
def bundle_command(command)
|
367
|
+
def bundle_command(command, env = {})
|
404
368
|
say_status :run, "bundle #{command}"
|
405
369
|
|
406
370
|
# We are going to shell out rather than invoking Bundler::CLI.new(command)
|
@@ -408,19 +372,21 @@ module Rails
|
|
408
372
|
# its own vendored Thor, which could be a different version. Running both
|
409
373
|
# things in the same process is a recipe for a night with paracetamol.
|
410
374
|
#
|
411
|
-
# We unset temporary bundler variables to load proper bundler and Gemfile.
|
412
|
-
#
|
413
375
|
# Thanks to James Tucker for the Gem tricks involved in this call.
|
414
376
|
_bundle_command = Gem.bin_path("bundler", "bundle")
|
415
377
|
|
416
378
|
require "bundler"
|
417
|
-
Bundler.
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
379
|
+
Bundler.with_original_env do
|
380
|
+
exec_bundle_command(_bundle_command, command, env)
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
def exec_bundle_command(bundle_command, command, env)
|
385
|
+
full_command = %Q["#{Gem.ruby}" "#{bundle_command}" #{command}]
|
386
|
+
if options[:quiet]
|
387
|
+
system(env, full_command, out: File::NULL)
|
388
|
+
else
|
389
|
+
system(env, full_command)
|
424
390
|
end
|
425
391
|
end
|
426
392
|
|
@@ -432,6 +398,10 @@ module Rails
|
|
432
398
|
!options[:skip_spring] && !options.dev? && Process.respond_to?(:fork) && !RUBY_PLATFORM.include?("cygwin")
|
433
399
|
end
|
434
400
|
|
401
|
+
def webpack_install?
|
402
|
+
!(options[:skip_javascript] || options[:skip_webpack_install])
|
403
|
+
end
|
404
|
+
|
435
405
|
def depends_on_system_test?
|
436
406
|
!(options[:skip_system_test] || options[:skip_test] || options[:api])
|
437
407
|
end
|
@@ -441,27 +411,29 @@ module Rails
|
|
441
411
|
end
|
442
412
|
|
443
413
|
def depend_on_bootsnap?
|
444
|
-
!options[:skip_bootsnap] && !options[:dev]
|
414
|
+
!options[:skip_bootsnap] && !options[:dev] && !defined?(JRUBY_VERSION)
|
445
415
|
end
|
446
416
|
|
447
417
|
def os_supports_listen_out_of_the_box?
|
448
|
-
RbConfig::CONFIG["host_os"]
|
418
|
+
/darwin|linux/.match?(RbConfig::CONFIG["host_os"])
|
449
419
|
end
|
450
420
|
|
451
421
|
def run_bundle
|
452
|
-
bundle_command("install") if bundle_install?
|
422
|
+
bundle_command("install", "BUNDLE_IGNORE_MESSAGES" => "1") if bundle_install?
|
453
423
|
end
|
454
424
|
|
455
425
|
def run_webpack
|
456
|
-
if
|
426
|
+
if webpack_install?
|
457
427
|
rails_command "webpacker:install"
|
458
|
-
|
428
|
+
if options[:webpack] && options[:webpack] != "webpack"
|
429
|
+
rails_command "webpacker:install:#{options[:webpack]}"
|
430
|
+
end
|
459
431
|
end
|
460
432
|
end
|
461
433
|
|
462
|
-
def
|
463
|
-
if bundle_install?
|
464
|
-
bundle_command("
|
434
|
+
def generate_bundler_binstub
|
435
|
+
if bundle_install?
|
436
|
+
bundle_command("binstubs bundler")
|
465
437
|
end
|
466
438
|
end
|
467
439
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
module AppName # :nodoc:
|
6
|
+
RESERVED_NAMES = %w(application destroy plugin runner test)
|
7
|
+
|
8
|
+
private
|
9
|
+
def app_name
|
10
|
+
@app_name ||= original_app_name.tr('\\', "").tr("-. ", "_")
|
11
|
+
end
|
12
|
+
|
13
|
+
def original_app_name
|
14
|
+
@original_app_name ||= defined_app_const_base? ? defined_app_name : File.basename(destination_root)
|
15
|
+
end
|
16
|
+
|
17
|
+
def defined_app_name
|
18
|
+
defined_app_const_base.underscore
|
19
|
+
end
|
20
|
+
|
21
|
+
def defined_app_const_base
|
22
|
+
Rails.respond_to?(:application) && defined?(Rails::Application) &&
|
23
|
+
Rails.application.is_a?(Rails::Application) && Rails.application.class.name.chomp("::Application")
|
24
|
+
end
|
25
|
+
|
26
|
+
alias :defined_app_const_base? :defined_app_const_base
|
27
|
+
|
28
|
+
def app_const_base
|
29
|
+
@app_const_base ||= defined_app_const_base || app_name.gsub(/\W/, "_").squeeze("_").camelize
|
30
|
+
end
|
31
|
+
alias :camelized :app_const_base
|
32
|
+
|
33
|
+
def app_const
|
34
|
+
@app_const ||= "#{app_const_base}::Application"
|
35
|
+
end
|
36
|
+
|
37
|
+
def valid_const?
|
38
|
+
if /^\d/.match?(app_const)
|
39
|
+
raise Error, "Invalid application name #{original_app_name}. Please give a name which does not start with numbers."
|
40
|
+
elsif RESERVED_NAMES.include?(original_app_name)
|
41
|
+
raise Error, "Invalid application name #{original_app_name}. Please give a " \
|
42
|
+
"name which does not match one of the reserved rails " \
|
43
|
+
"words: #{RESERVED_NAMES.join(", ")}"
|
44
|
+
elsif Object.const_defined?(app_const_base)
|
45
|
+
raise Error, "Invalid application name #{original_app_name}, constant #{app_const_base} is already in use. Please choose another application name."
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -19,11 +19,17 @@ module Rails
|
|
19
19
|
include Rails::Generators::Actions
|
20
20
|
|
21
21
|
class_option :skip_namespace, type: :boolean, default: false,
|
22
|
-
desc: "Skip namespace (affects only isolated
|
22
|
+
desc: "Skip namespace (affects only isolated engines)"
|
23
|
+
class_option :skip_collision_check, type: :boolean, default: false,
|
24
|
+
desc: "Skip collision check"
|
23
25
|
|
24
26
|
add_runtime_options!
|
25
27
|
strict_args_position!
|
26
28
|
|
29
|
+
def self.exit_on_failure? # :nodoc:
|
30
|
+
false
|
31
|
+
end
|
32
|
+
|
27
33
|
# Returns the source root for this generator using default_source_root as default.
|
28
34
|
def self.source_root(path = nil)
|
29
35
|
@_source_root = path if path
|
@@ -47,7 +53,7 @@ module Rails
|
|
47
53
|
# is removed.
|
48
54
|
def self.namespace(name = nil)
|
49
55
|
return super if name
|
50
|
-
@namespace ||= super.
|
56
|
+
@namespace ||= super.delete_suffix("_generator").sub(/:generators:/, ":")
|
51
57
|
end
|
52
58
|
|
53
59
|
# Convenience method to hide this generator from the available ones when
|
@@ -73,7 +79,7 @@ module Rails
|
|
73
79
|
#
|
74
80
|
# For example, if the user invoke the controller generator as:
|
75
81
|
#
|
76
|
-
# rails generate controller Account --test-framework=test_unit
|
82
|
+
# bin/rails generate controller Account --test-framework=test_unit
|
77
83
|
#
|
78
84
|
# The controller generator will then try to invoke the following generators:
|
79
85
|
#
|
@@ -128,11 +134,11 @@ module Rails
|
|
128
134
|
# All hooks come with switches for user interface. If you do not want
|
129
135
|
# to use any test framework, you can do:
|
130
136
|
#
|
131
|
-
# rails generate controller Account --skip-test-framework
|
137
|
+
# bin/rails generate controller Account --skip-test-framework
|
132
138
|
#
|
133
139
|
# Or similarly:
|
134
140
|
#
|
135
|
-
# rails generate controller Account --no-test-framework
|
141
|
+
# bin/rails generate controller Account --no-test-framework
|
136
142
|
#
|
137
143
|
# ==== Boolean hooks
|
138
144
|
#
|
@@ -144,7 +150,7 @@ module Rails
|
|
144
150
|
#
|
145
151
|
# Then, if you want webrat to be invoked, just supply:
|
146
152
|
#
|
147
|
-
# rails generate controller Account --webrat
|
153
|
+
# bin/rails generate controller Account --webrat
|
148
154
|
#
|
149
155
|
# The hooks lookup is similar as above:
|
150
156
|
#
|
@@ -231,7 +237,7 @@ module Rails
|
|
231
237
|
# Invoke source_root so the default_source_root is set.
|
232
238
|
base.source_root
|
233
239
|
|
234
|
-
if base.name && base.name
|
240
|
+
if base.name && !base.name.end_with?("Base")
|
235
241
|
Rails::Generators.subclasses << base
|
236
242
|
|
237
243
|
Rails::Generators.templates_path.each do |path|
|
@@ -245,11 +251,12 @@ module Rails
|
|
245
251
|
end
|
246
252
|
|
247
253
|
private
|
248
|
-
|
249
254
|
# Check whether the given class names are already taken by user
|
250
255
|
# application or Ruby on Rails.
|
251
256
|
def class_collisions(*class_names)
|
252
257
|
return unless behavior == :invoke
|
258
|
+
return if options.skip_collision_check?
|
259
|
+
return if options.force?
|
253
260
|
|
254
261
|
class_names.flatten.each do |class_name|
|
255
262
|
class_name = class_name.to_s
|
@@ -262,8 +269,8 @@ module Rails
|
|
262
269
|
|
263
270
|
if last && last.const_defined?(last_name.camelize, false)
|
264
271
|
raise Error, "The name '#{class_name}' is either already used in your application " \
|
265
|
-
"or reserved by Ruby on Rails. Please choose an alternative
|
266
|
-
"this generator again."
|
272
|
+
"or reserved by Ruby on Rails. Please choose an alternative or use --skip-collision-check " \
|
273
|
+
"or --force to skip this check and run this generator again."
|
267
274
|
end
|
268
275
|
end
|
269
276
|
end
|
@@ -312,7 +319,7 @@ module Rails
|
|
312
319
|
|
313
320
|
# Use Rails default banner.
|
314
321
|
def self.banner # :doc:
|
315
|
-
"rails generate #{namespace.
|
322
|
+
"rails generate #{namespace.delete_prefix("rails:")} #{arguments.map(&:usage).join(' ')} [options]".gsub(/\s+/, " ")
|
316
323
|
end
|
317
324
|
|
318
325
|
# Sets the base_name taking into account the current class namespace.
|
@@ -329,7 +336,7 @@ module Rails
|
|
329
336
|
def self.generator_name # :doc:
|
330
337
|
@generator_name ||= begin
|
331
338
|
if generator = name.to_s.split("::").last
|
332
|
-
generator.
|
339
|
+
generator.delete_suffix!("Generator")
|
333
340
|
generator.underscore
|
334
341
|
end
|
335
342
|
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
module Database # :nodoc:
|
6
|
+
JDBC_DATABASES = %w( jdbcmysql jdbcsqlite3 jdbcpostgresql jdbc )
|
7
|
+
DATABASES = %w( mysql postgresql sqlite3 oracle sqlserver ) + JDBC_DATABASES
|
8
|
+
|
9
|
+
def initialize(*)
|
10
|
+
super
|
11
|
+
convert_database_option_for_jruby
|
12
|
+
end
|
13
|
+
|
14
|
+
def gem_for_database(database = options[:database])
|
15
|
+
case database
|
16
|
+
when "mysql" then ["mysql2", ["~> 0.5"]]
|
17
|
+
when "postgresql" then ["pg", ["~> 1.1"]]
|
18
|
+
when "sqlite3" then ["sqlite3", ["~> 1.4"]]
|
19
|
+
when "oracle" then ["activerecord-oracle_enhanced-adapter", nil]
|
20
|
+
when "sqlserver" then ["activerecord-sqlserver-adapter", nil]
|
21
|
+
when "jdbcmysql" then ["activerecord-jdbcmysql-adapter", nil]
|
22
|
+
when "jdbcsqlite3" then ["activerecord-jdbcsqlite3-adapter", nil]
|
23
|
+
when "jdbcpostgresql" then ["activerecord-jdbcpostgresql-adapter", nil]
|
24
|
+
when "jdbc" then ["activerecord-jdbc-adapter", nil]
|
25
|
+
else [database, nil]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def convert_database_option_for_jruby
|
30
|
+
if defined?(JRUBY_VERSION)
|
31
|
+
opt = options.dup
|
32
|
+
case opt[:database]
|
33
|
+
when "postgresql" then opt[:database] = "jdbcpostgresql"
|
34
|
+
when "mysql" then opt[:database] = "jdbcmysql"
|
35
|
+
when "sqlite3" then opt[:database] = "jdbcsqlite3"
|
36
|
+
end
|
37
|
+
self.options = opt.freeze
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
def mysql_socket
|
43
|
+
@mysql_socket ||= [
|
44
|
+
"/tmp/mysql.sock", # default
|
45
|
+
"/var/run/mysqld/mysqld.sock", # debian/gentoo
|
46
|
+
"/var/tmp/mysql.sock", # freebsd
|
47
|
+
"/var/lib/mysql/mysql.sock", # fedora
|
48
|
+
"/opt/local/lib/mysql/mysql.sock", # fedora
|
49
|
+
"/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
|
50
|
+
"/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
|
51
|
+
"/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
|
52
|
+
"/opt/lampp/var/mysql/mysql.sock" # xampp for linux
|
53
|
+
].find { |f| File.exist?(f) } unless Gem.win_platform?
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -1,12 +1,12 @@
|
|
1
|
-
<%%= form_with(model: <%= model_resource_name
|
1
|
+
<%%= form_with(model: <%= model_resource_name %>) do |form| %>
|
2
2
|
<%% if <%= singular_table_name %>.errors.any? %>
|
3
3
|
<div id="error_explanation">
|
4
4
|
<h2><%%= pluralize(<%= singular_table_name %>.errors.count, "error") %> prohibited this <%= singular_table_name %> from being saved:</h2>
|
5
5
|
|
6
6
|
<ul>
|
7
|
-
|
8
|
-
|
9
|
-
|
7
|
+
<%% <%= singular_table_name %>.errors.each do |error| %>
|
8
|
+
<li><%%= error.full_message %></li>
|
9
|
+
<%% end %>
|
10
10
|
</ul>
|
11
11
|
</div>
|
12
12
|
<%% end %>
|
@@ -21,6 +21,9 @@
|
|
21
21
|
<div class="field">
|
22
22
|
<%%= form.label :password_confirmation %>
|
23
23
|
<%%= form.password_field :password_confirmation %>
|
24
|
+
<% elsif attribute.attachments? -%>
|
25
|
+
<%%= form.label :<%= attribute.column_name %> %>
|
26
|
+
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %>, multiple: true %>
|
24
27
|
<% else -%>
|
25
28
|
<%%= form.label :<%= attribute.column_name %> %>
|
26
29
|
<%%= form.<%= attribute.field_type %> :<%= attribute.column_name %> %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<%% @<%= plural_table_name %>.each do |<%= singular_table_name %>| %>
|
17
17
|
<tr>
|
18
18
|
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
19
|
-
<td><%%= <%= singular_table_name %>.<%= attribute.
|
19
|
+
<td><%%= <%= singular_table_name %>.<%= attribute.column_name %> %></td>
|
20
20
|
<% end -%>
|
21
21
|
<td><%%= link_to 'Show', <%= model_resource_name %> %></td>
|
22
22
|
<td><%%= link_to 'Edit', edit_<%= singular_route_name %>_path(<%= singular_table_name %>) %></td>
|
@@ -3,7 +3,15 @@
|
|
3
3
|
<% attributes.reject(&:password_digest?).each do |attribute| -%>
|
4
4
|
<p>
|
5
5
|
<strong><%= attribute.human_name %>:</strong>
|
6
|
-
|
6
|
+
<% if attribute.attachment? -%>
|
7
|
+
<%%= link_to @<%= singular_table_name %>.<%= attribute.column_name %>.filename, @<%= singular_table_name %>.<%= attribute.column_name %> if @<%= singular_table_name %>.<%= attribute.column_name %>.attached? %>
|
8
|
+
<% elsif attribute.attachments? -%>
|
9
|
+
<%% @<%= singular_table_name %>.<%= attribute.column_name %>.each do |<%= attribute.singular_name %>| %>
|
10
|
+
<div><%%= link_to <%= attribute.singular_name %>.filename, <%= attribute.singular_name %> %></div>
|
11
|
+
<%% end %>
|
12
|
+
<% else -%>
|
13
|
+
<%%= @<%= singular_table_name %>.<%= attribute.column_name %> %>
|
14
|
+
<% end -%>
|
7
15
|
</p>
|
8
16
|
|
9
17
|
<% end -%>
|