Class: Blog::Gem::Author

Inherits:
ApplicationRecord show all
Includes:
Gravtastic
Defined in:
app/models/blog/gem/author.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_admin(name:, password:, email:) ⇒ Object



23
24
25
# File 'app/models/blog/gem/author.rb', line 23

def self.create_admin(name:, password:, email:)
  create(name: name, password: password, password_confirmation: password, private_email: email, public_email: email, admin: true)
end

Instance Method Details

#imageObject



27
28
29
30
31
32
33
# File 'app/models/blog/gem/author.rb', line 27

def image
  if avatar_or_gravatar == "avatar"
    avatar.url(:image)
  else
    gravatar_url
  end
end

#to_pathObject



19
20
21
# File 'app/models/blog/gem/author.rb', line 19

def to_path
  "#{Blog::Gem.path}/author/#{url}"
end