From 69ac53cfec067103427945b3ef137b9ce07294c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Tue, 19 Nov 2013 22:34:32 -0200 Subject: Add documentation and CHANGELOG entry to Application#verifier --- railties/CHANGELOG.md | 12 ++++++++++++ railties/lib/rails/application.rb | 9 +++++++++ 2 files changed, 21 insertions(+) (limited to 'railties') diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 0eda858cca..a42e942f9b 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -1,3 +1,15 @@ +* Add `Application#verifier` method to return a application's message verifier. + + This verifier can be used to generate and verify signed messages in the application. + + message = Rails.application.verifier.generate('my sensible data') + Rails.application.verifier.verify(message) + # => 'my sensible data' + + See the `ActiveSupport::MessageVerifier` documentation to more information. + + *Rafael Mendonça França* + * The [Spring application preloader](https://github.com/jonleighton/spring) is now installed by default for new applications. It uses the development group of diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index ccd97af655..320da8f100 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -158,6 +158,15 @@ module Rails end end + # Return the application's message verifier. + # + # This verify can be used to generate and verify signed messages in the application. + # + # message = Rails.application.verifier.generate('my sensible data') + # Rails.application.verifier.verify(message) + # # => 'my sensible data' + # + # See the +ActiveSupport::MessageVerifier+ documentation to more information. def verifier @verifier ||= begin if config.respond_to?(:message_verifier_salt) -- cgit v1.2.3