From 61f6b47204c63715b4a49f078f9d58f24f06f502 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Mendon=C3=A7a=20Fran=C3=A7a?= Date: Thu, 19 Dec 2013 17:00:53 -0200 Subject: Change the message verifier argument to verifier_name --- railties/CHANGELOG.md | 4 ++-- railties/lib/rails/application.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'railties') diff --git a/railties/CHANGELOG.md b/railties/CHANGELOG.md index 8fbac31c0a..084b87bf35 100644 --- a/railties/CHANGELOG.md +++ b/railties/CHANGELOG.md @@ -35,8 +35,8 @@ This verifier can be used to generate and verify signed messages in the application. - message = Rails.application.message_verifier('salt').generate('my sensible data') - Rails.application.message_verifier('salt').verify(message) + message = Rails.application.message_verifier('sensitive_data').generate('my sensible data') + Rails.application.message_verifier('sensitive_data').verify(message) # => 'my sensible data' It is recommended not to use the same verifier for different things, so you can get different diff --git a/railties/lib/rails/application.rb b/railties/lib/rails/application.rb index 06acb4c877..795321bc20 100644 --- a/railties/lib/rails/application.rb +++ b/railties/lib/rails/application.rb @@ -170,18 +170,18 @@ module Rails # # ==== Parameters # - # * +salt+ - the salt that will be used to generate the secret key of the verifier. + # * +verifier_name+ - the name of the message verifier. # # ==== Examples # - # message = Rails.application.message_verifier('salt').generate('my sensible data') - # Rails.application.message_verifier('salt').verify(message) + # message = Rails.application.message_verifier('sensitive_data').generate('my sensible data') + # Rails.application.message_verifier('sensitive_data').verify(message) # # => 'my sensible data' # # See the +ActiveSupport::MessageVerifier+ documentation for more information. - def message_verifier(salt) - @message_verifiers[salt] ||= begin - secret = key_generator.generate_key(salt) + def message_verifier(verifier_name) + @message_verifiers[verifier_name] ||= begin + secret = key_generator.generate_key(verifier_name) ActiveSupport::MessageVerifier.new(secret) end end -- cgit v1.2.3