Sha256: c5a2a3eb940dfc94bf1b4e862f11ff9df3b39458947b987dcd68fbce1521111a

Contents?: true

Size: 642 Bytes

Versions: 13

Compression:

Stored size: 642 Bytes

Contents

module ThinkFeelDoDashboard
  module Concerns
    # is included in the User model and automatically
    # sets a password on create
    module Password
      extend ActiveSupport::Concern

      # This is perfect for including functionality
      # provided by 3rd party gems, etc.
      included do
        before_validation :set_password, on: :create
      end

      # methods added to Class itself...
      module ClassMethods
      end

      private

      def set_password
        random_string = SecureRandom.hex(64)
        self.password = random_string
        self.password_confirmation = random_string
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
think_feel_do_dashboard-1.2.0.beta1 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.21 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.20 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.19 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.18 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.17 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.16 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.15 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.14 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.13 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.12 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.11 app/models/think_feel_do_dashboard/concerns/password.rb
think_feel_do_dashboard-1.1.10 app/models/think_feel_do_dashboard/concerns/password.rb