1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/lib/active_support
Genadi Samokovarov 45f1c7a3e1 Introduce Actionable Errors
Actionable errors let's you dispatch actions from Rails' error pages. This
can help you save time if you have a clear action for the resolution of
common development errors.

The de-facto example are pending migrations. Every time pending migrations
are found, a middleware raises an error. With actionable errors, you can
run the migrations right from the error page. Other examples include Rails
plugins that need to run a rake task to setup themselves. They can now
raise actionable errors to run the setup straight from the error pages.

Here is how to define an actionable error:

```ruby
class PendingMigrationError < MigrationError #:nodoc:
  include ActiveSupport::ActionableError

  action "Run pending migrations" do
    ActiveRecord::Tasks::DatabaseTasks.migrate
  end
end
```

To make an error actionable, include the `ActiveSupport::ActionableError`
module and invoke the `action` class macro to define the action. An action
needs a name and a procedure to execute. The name is shown as the name of a
button on the error pages. Once clicked, it will invoke the given
procedure.
2019-04-19 14:14:06 +09:00
..
cache Document redis: Object option 2019-04-18 15:19:53 -07:00
concurrency
core_ext Preserve html_safe? status on ActiveSupport::SafeBuffer#* 2019-04-19 06:32:55 +09:00
dependencies Auto-correct Style/RedundantBegin cop offences 2019-04-12 08:07:40 +09:00
deprecation Module#{define_method,alias_method,undef_method,remove_method} become public since Ruby 2.5 2018-12-21 01:39:18 +09:00
duration Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
inflector Update docs for 'parameterize()' [ci skip] 2019-03-16 03:24:26 +05:30
json Upgrade Rubocop to 0.61.1 and fix offenses 2018-12-10 19:22:56 -02:00
locale Improve the performance of ActiveSupport::Inflector.ordinal 2018-04-29 20:21:58 +09:00
log_subscriber
messages
multibyte Use String#truncate_bytes inside Multibyte::Chars#limit 2018-10-20 12:00:37 -07:00
notifications Remove @duration instance variable since we're not maintaining instances variables such as @cpu_time, @idle_time and @allocations; this reduces one allocation 2019-04-16 03:45:39 +05:30
number_helper Missing require "active_support/number_helper/number_converter" 2018-10-20 14:58:04 +09:00
testing If exception occurs during setup, add to each test executed 2019-04-18 12:23:24 -06:00
values Privatize and add # :nodoc: to constants 2018-10-28 17:51:22 +01:00
xml_mini Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
actionable_error.rb Introduce Actionable Errors 2019-04-19 14:14:06 +09:00
all.rb
array_inquirer.rb
backtrace_cleaner.rb Find query_source_location using lazy Enumerator 2019-04-15 16:13:06 -07:00
benchmarkable.rb
builder.rb
cache.rb Improve wording in cache documentation [ci skip] 2019-03-08 20:09:16 +02:00
callbacks.rb Make it easier to find abort documentation 2018-10-01 11:49:07 +02:00
concern.rb Add documentations to AS::Concern#included and #class_methods 2019-04-17 18:41:53 +09:00
configurable.rb Change wording of some instances of 'opt out' [ci skip] 2019-03-12 20:06:02 +05:30
core_ext.rb
current_attributes.rb Support before_reset callback in CurrentAttributes 2019-01-30 16:10:06 +01:00
dependencies.rb fixes eager loading edge case in :zeitwerk mode 2019-03-30 09:33:48 +01:00
deprecation.rb
descendants_tracker.rb depend on Zeitwerk 2.1.0 2019-04-09 11:06:44 +02:00
digest.rb
duration.rb Removed unused require for active_support/deprecation 2019-04-17 17:59:20 +05:30
encrypted_configuration.rb Bugfix: ActiveSupport::EncryptedConfiguration reading of comment-only encrypted files (#34014) 2018-10-05 08:06:33 +09:00
encrypted_file.rb Add missing require "tmpdir" in ActiveSupport::EncryptedFile 2019-02-05 14:19:14 -05:00
evented_file_update_checker.rb Match evented checker behavior on dir with no exts 2019-03-15 13:29:14 -07:00
execution_wrapper.rb Missing require "concurrent/hash" 2018-10-20 14:58:04 +09:00
executor.rb
file_update_checker.rb
gem_version.rb Prep release 2019-03-11 11:58:15 -04:00
gzip.rb
hash_with_indifferent_access.rb Speed improvement for HashWithIndifferentAccess#values_at 2019-04-02 22:58:52 +02:00
i18n.rb ActiveSupport::Inflector#ordinal and ActiveSupport::Inflector#ordinalize 2018-03-05 08:41:49 -05:00
i18n_railtie.rb Describe how to silence the deprecation warning about empty I18n fallbacks 2019-01-25 10:57:20 +01:00
inflections.rb
inflector.rb
json.rb
key_generator.rb Remove secret_token rack env and cookie upgrade code 2019-01-17 16:08:34 -05:00
lazy_load_hooks.rb A Class is a Module so we remove one conditional 2018-07-04 14:55:53 -04:00
log_subscriber.rb Fix examples in ActiveSupport::LogSubscriber docs 2019-01-01 20:27:54 -05:00
logger.rb Fix the LoggerSilence to work as described: 2018-10-02 17:17:23 -04:00
logger_silence.rb Fix the LoggerSilence to work as described: 2018-10-02 17:17:23 -04:00
logger_thread_safe_level.rb Fix the LoggerSilence to work as described: 2018-10-02 17:17:23 -04:00
message_encryptor.rb Fix small typo in docs 2019-02-15 08:18:47 -07:00
message_verifier.rb Fix small typo in docs 2019-02-15 08:18:47 -07:00
multibyte.rb
notifications.rb use a proxy matcher for AS::N fanout 2019-02-11 16:04:25 -08:00
number_helper.rb Missing require "active_support/dependencies/autoload" 2018-10-20 14:58:04 +09:00
option_merger.rb
ordered_hash.rb
ordered_options.rb
parameter_filter.rb Implement AR#inspect using ParamterFilter. 2018-10-19 14:16:03 +09:00
per_thread_registry.rb
proxy_object.rb
rails.rb
railtie.rb
reloader.rb Enable Style/RedundantBegin cop to avoid newly adding redundant begin block 2018-12-21 06:12:42 +09:00
rescuable.rb
security_utils.rb Don't encode in secure_compare for speedup 2019-03-26 21:43:52 -04:00
string_inquirer.rb
subscriber.rb Added 'detach_from' to 'ActiveSupport::Subscriber' to detach a subscriber from a namespace. 2019-04-04 10:57:57 +05:30
tagged_logging.rb Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
test_case.rb Add option to set parallel test worker count to the physical core count of the machine (#34735) 2018-12-18 10:25:35 -08:00
time.rb
time_with_zone.rb Add Style/RedundantFreeze to remove redudant .freeze 2018-09-29 07:18:44 +00:00
version.rb
xml_mini.rb Add missing require for String#to_d 2018-12-21 18:12:10 +09:00