Sha256: c60299772e63422ca3113cbeb3a25642fcb67de996f1c49fd5922e38562d6566

Contents?: true

Size: 1.09 KB

Versions: 4

Compression:

Stored size: 1.09 KB

Contents

module Hatchy
  class User < ActiveRecord::Base
    # Include default devise modules. Others available are:
    # :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
      :recoverable, :rememberable, :trackable, :validatable

    belongs_to :country,          class_name:'Hatchy::Country'
    has_many :projects,           class_name:'Hatchy::Project'
    has_many :category_followers, class_name:'Hatchy::CategoryFollower', dependent: :destroy
    has_many :categories,         through: :category_followers
    has_many :contributions,      class_name:'Hatchy::Contribution'
    has_many :payments,           through: :contributions
    has_many :credit_cards,       class_name:'Hatchy::CreditCard'
    has_one :bank_account,        class_name:'Hatchy::BankAccount', dependent: :destroy

    validates :email, presence: true, uniqueness: true
    mount_uploader :profile_img, Hatchy::UserUploader
    accepts_nested_attributes_for :bank_account, allow_destroy: true

    def full_name
      "#{first_name.capitalize} #{last_name.capitalize}"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hatchy-0.0.8.pre app/models/hatchy/user.rb
hatchy-0.0.7.pre app/models/hatchy/user.rb
hatchy-0.0.6.pre app/models/hatchy/user.rb
hatchy-0.0.5.pre app/models/hatchy/user.rb