aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionview/lib/action_view/helpers/tags/color_field.rb2
-rw-r--r--actionview/lib/action_view/helpers/tags/datetime_field.rb2
-rw-r--r--guides/source/getting_started.md6
-rw-r--r--guides/source/migrations.md2
-rw-r--r--railties/CHANGELOG.md4
-rw-r--r--railties/lib/rails/commands.rb16
6 files changed, 17 insertions, 15 deletions
diff --git a/actionview/lib/action_view/helpers/tags/color_field.rb b/actionview/lib/action_view/helpers/tags/color_field.rb
index bab28352ed..b4bbe92746 100644
--- a/actionview/lib/action_view/helpers/tags/color_field.rb
+++ b/actionview/lib/action_view/helpers/tags/color_field.rb
@@ -4,7 +4,7 @@ module ActionView
class ColorField < TextField # :nodoc:
def render
options = @options.stringify_keys
- options["value"] = options.fetch("value") { validate_color_string(value(object)) }
+ options["value"] ||= validate_color_string(value(object))
@options = options
super
end
diff --git a/actionview/lib/action_view/helpers/tags/datetime_field.rb b/actionview/lib/action_view/helpers/tags/datetime_field.rb
index 416d225706..25e7e05ec6 100644
--- a/actionview/lib/action_view/helpers/tags/datetime_field.rb
+++ b/actionview/lib/action_view/helpers/tags/datetime_field.rb
@@ -4,7 +4,7 @@ module ActionView
class DatetimeField < TextField # :nodoc:
def render
options = @options.stringify_keys
- options["value"] = options.fetch("value") { format_date(value(object)) }
+ options["value"] ||= format_date(value(object))
options["min"] = format_date(options["min"])
options["max"] = format_date(options["max"])
@options = options
diff --git a/guides/source/getting_started.md b/guides/source/getting_started.md
index 2574a2c111..05029b9ebe 100644
--- a/guides/source/getting_started.md
+++ b/guides/source/getting_started.md
@@ -1062,7 +1062,7 @@ You can call `destroy` on Active Record objects when you want to delete
them from the database. Note that we don't need to add a view for this
action since we're redirecting to the `index` action.
-Finally, add a 'destroy' link to your `index` action template
+Finally, add a 'Destroy' link to your `index` action template
(`app/views/posts/index.html.erb`) to wrap everything
together.
@@ -1088,8 +1088,8 @@ together.
</table>
```
-Here we're using `link_to` in a different way. We pass the named route as the first argument,
-and then the final two keys as another argument. The `:method` and `:'data-confirm'`
+Here we're using `link_to` in a different way. We pass the named route as the second argument,
+and then the options as another argument. The `:method` and `:'data-confirm'`
options are used as HTML5 attributes so that when the link is clicked,
Rails will first show a confirm dialog to the user, and then submit the link with method `delete`.
This is done via the JavaScript file `jquery_ujs` which is automatically included
diff --git a/guides/source/migrations.md b/guides/source/migrations.md
index 508e52a77c..035f9499de 100644
--- a/guides/source/migrations.md
+++ b/guides/source/migrations.md
@@ -314,7 +314,7 @@ will produce a migration that looks like this
class AddDetailsToProducts < ActiveRecord::Migration
def change
add_column :products, :price, precision: 5, scale: 2
- add_reference :products, :user, polymorphic: true, index: true
+ add_reference :products, :supplier, polymorphic: true, index: true
end
end
```
diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md
index eb0545ccbf..639dd70152 100644
--- a/railties/CHANGELOG.md
+++ b/railties/CHANGELOG.md
@@ -1,3 +1,7 @@
+* Fix `rails plugin --help` command.
+
+ *Richard Schneeman*
+
* Omit turbolinks configuration completely on skip_javascript generator option.
*Nikita Fedyashev*
diff --git a/railties/lib/rails/commands.rb b/railties/lib/rails/commands.rb
index 48007dd2ab..c2ce2b4d2a 100644
--- a/railties/lib/rails/commands.rb
+++ b/railties/lib/rails/commands.rb
@@ -35,19 +35,17 @@ command = ARGV.shift
command = aliases[command] || command
case command
-when 'generate', 'destroy', 'plugin'
+when 'plugin'
+ require "rails/commands/plugin_new"
+when 'generate', 'destroy'
require 'rails/generators'
- if command == 'plugin' && ARGV.first == 'new'
- require "rails/commands/plugin_new"
- else
- require APP_PATH
- Rails.application.require_environment!
+ require APP_PATH
+ Rails.application.require_environment!
- Rails.application.load_generators
+ Rails.application.load_generators
- require "rails/commands/#{command}"
- end
+ require "rails/commands/#{command}"
when 'console'
require 'rails/commands/console'