Sha256: 05d04f21ffffb679e9d4829e3d04dc5fadd1fa7eade660532cc53b00505de03d

Contents?: true

Size: 724 Bytes

Versions: 1

Compression:

Stored size: 724 Bytes

Contents

class User < ActiveRecord::Base
<% if devise? -%>
  devise :database_authenticatable, :registerable, :recoverable,
         :rememberable, :trackable, :validatable, :confirmable
         # :omniauthable, omniauth_providers: [:facebook]
         # :lockable, :timeoutable

<% end -%>
<% if user_role_field? -%>
  as_enum :role, [:guest, :regular, :trusted, :moderator, :admin],
          source: :role, map: :string, accessor: :whiny

  before_create do
    self.role = :regular
  end

  def self.guest
    User.new
  end

  def guest?
    new_record?
  end
<% end -%>

<% if devise? -%>
  def send_devise_notification(notification, *args)
    devise_mailer.send(notification, self, *args).deliver_later
  end
<% end -%>
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pineapples-0.3.345 lib/pineapples/templates/app/models/user!=needs_user_model!.rb.tt