Sha256: 7210b5a6bb9d240bac245d9b482736794f4bcccf9adcec77dd7167cec54d8470

Contents?: true

Size: 546 Bytes

Versions: 3

Compression:

Stored size: 546 Bytes

Contents

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

class User < ApplicationRecord
  validates :name, presence: true, length: {in: 2..50}
  validates :email, 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

3 entries across 3 versions & 1 rubygems

Version Path
rails_bootstrap_form-0.4.2 demo/app/models/user.rb
rails_bootstrap_form-0.4.1 demo/app/models/user.rb
rails_bootstrap_form-0.4.0 demo/app/models/user.rb