Added Zeus user

This commit is contained in:
Ilion Beyst 2015-09-08 21:38:29 +02:00
parent d48f5ffa2a
commit 1233431d14

View file

@ -18,7 +18,6 @@ class User < ActiveRecord::Base
class_name: 'Transaction', foreign_key: 'debtor_id'
validates :name, presence: true, uniqueness: true
validates :balance, presence: true
def transactions
Transaction.where("creditor_id = ? OR debtor_id = ?", id, id)
@ -35,4 +34,8 @@ class User < ActiveRecord::Base
user.name = auth.uid
end
end
def self.zeus
@@zeus ||= find_or_create_by name: 'Zeus'
end
end