Class: Adminpanel::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/adminpanel/user.rb

Constant Summary collapse

VALID_EMAIL_REGEX =
/\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.display_nameObject



40
41
42
43
# File 'app/models/adminpanel/user.rb', line 40

def self.display_name
  "Usuario"

end

.form_attributesObject



31
32
33
34
35
36
37
38
# File 'app/models/adminpanel/user.rb', line 31

def self.form_attributes
  [
    {"name" => {"type" => "text_field", "name" => "Nombre", 'label' => "Nombre", "placeholder" => "Nombre"}},
    {"email" => {"type" => "text_field", "name" => "Correo", 'label' => 'Correo', 'placeholder' => 'Correo'}},
    {"password" => {"type" => "password_field", "name" => "Contrasena", 'label' => I18n.t('model.attributes.password'), "placeholder" => I18n.t('model.attributes.password'), 'show' => 'false'}},
    {"password_confirmation" => {"type" => "password_field", "name" => "Confirmacion de contrasena", 'placeholder' => I18n.t('model.attributes.password_confirmation'), 'label' => I18n.t('model.attributes.password_confirmation'), 'show' => 'false'}},
  ]
end

Instance Method Details

#has_role?(role_sym) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'app/models/adminpanel/user.rb', line 27

def has_role?(role_sym)
  roles.any? { |r| r.name.underscore.to_sym == role_sym }
end