Class: QPublisher
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- QPublisher
- Includes:
- BCrypt
- Defined in:
- app/models/q_publisher.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.generate_random ⇒ Object
32 33 34 |
# File 'app/models/q_publisher.rb', line 32 def QPublisher.generate_random Digest::MD5.hexdigest(Time.now.to_s + rand(10000000).to_s) end |
Instance Method Details
#auth_secret ⇒ Object
16 17 18 |
# File 'app/models/q_publisher.rb', line 16 def auth_secret @auth_secret ||= Password.new(encrypted_auth_secret) end |
#auth_secret=(new_secret) ⇒ Object
20 21 22 23 |
# File 'app/models/q_publisher.rb', line 20 def auth_secret=(new_secret) @auth_secret = Password.create(new_secret) self.encrypted_auth_secret = @auth_secret end |
#generate_auth_secret ⇒ Object
25 26 27 28 29 30 |
# File 'app/models/q_publisher.rb', line 25 def generate_auth_secret gen = QPublisher.generate_random puts "Generate auth secret: #{gen}" self.auth_secret = gen self.save end |