Module: PasswordGenerator::ViewHelper
- Defined in:
- lib/password_generator/view_helper.rb
Overview
The ‘ViewHelper` module provides a helper method for generating random passwords in Rails views.
It is automatically included in the ‘ActionView::Base` class through the `Railtie`, making the `random_password_tag` method available for use in views.
Instance Method Summary collapse
-
#random_password_tag(length = 12) ⇒ String
Generates an HTML paragraph containing a randomly generated password.
Instance Method Details
#random_password_tag(length = 12) ⇒ String
Generates an HTML paragraph containing a randomly generated password.
15 16 17 18 |
# File 'lib/password_generator/view_helper.rb', line 15 def random_password_tag(length = 12) password = PasswordGenerator.generate_password(length) content_tag(:p, "Password: #{password}") end |