adds Valuator

This commit is contained in:
Juanjo Bazán
2016-02-17 17:46:59 +01:00
parent 9561259800
commit 009733a43b
6 changed files with 49 additions and 3 deletions

View File

@@ -12,6 +12,7 @@ class User < ActiveRecord::Base
has_one :administrator
has_one :moderator
has_one :valuator
has_one :organization
has_one :lock
has_many :flags
@@ -92,6 +93,10 @@ class User < ActiveRecord::Base
moderator.present?
end
def valuator?
valuator.present?
end
def organization?
organization.present?
end

6
app/models/valuator.rb Normal file
View File

@@ -0,0 +1,6 @@
class Valuator < ActiveRecord::Base
belongs_to :user, touch: true
delegate :name, :email, to: :user
validates :user_id, presence: true, uniqueness: true
end