Sha256: 9cdddf7d6dd8b8317308fc219bb47fd4966d84da44e71562eaf30e1cfa9c9cf5

Contents?: true

Size: 860 Bytes

Versions: 4

Compression:

Stored size: 860 Bytes

Contents

# -*- encoding: utf-8 -*-
# -*- frozen_string_literal: true -*-
# -*- warn_indent: true -*-

class User < ApplicationRecord

  attr_accessor :remember_me

  has_rich_text :life_story

  has_one_attached :avatar, dependent: :purge_later

  validates :name, presence: true, length: {in: 2..50}
  validates :terms, acceptance: true
  validates :email,
            :password,
            :mobile_number,
            :birth_date,
            :favorite_color,
            :fruit_id,
            :skill_ids,
            presence: true

  has_one :address, dependent: :destroy

  has_many :user_skills, dependent: :destroy
  has_many :skills, through: :user_skills, source: :skill

  belongs_to :fruit

  delegate :name, to: :fruit, prefix: true

  accepts_nested_attributes_for :address, update_only: true

  def address
    super.presence || build_address
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.9.9 demo/app/models/user.rb
rails_bootstrap_form-0.9.8 demo/app/models/user.rb
rails_bootstrap_form-0.9.7 demo/app/models/user.rb
rails_bootstrap_form-0.9.6 demo/app/models/user.rb