diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-12-19 17:00:53 -0200 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-12-19 17:05:22 -0200 |
commit | 61f6b47204c63715b4a49f078f9d58f24f06f502 (patch) | |
tree | 2873f101c9a1cbeab64aafbb140d19fc800d41bf /railties | |
parent | 87fc20a4aa4e0eddce0c418d73690b4e51ca47bd (diff) | |
download | rails-61f6b47204c63715b4a49f078f9d58f24f06f502.tar.gz rails-61f6b47204c63715b4a49f078f9d58f24f06f502.tar.bz2 rails-61f6b47204c63715b4a49f078f9d58f24f06f502.zip |
Change the message verifier argument to verifier_name
Diffstat (limited to 'railties')
-rw-r--r-- | railties/CHANGELOG.md | 4 | ||||
-rw-r--r-- | railties/lib/rails/application.rb | 12 |
2 files changed, 8 insertions, 8 deletions
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 |