Merge pull request #248 from openHPI/improve_groups
Improve groups with a view and always create a group
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
class Consumer < ApplicationRecord
|
||||
has_many :users
|
||||
|
||||
scope :with_users, -> { where('id IN (SELECT consumer_id FROM internal_users)') }
|
||||
scope :with_internal_users, -> { where('id IN (SELECT DISTINCT consumer_id FROM internal_users)') }
|
||||
scope :with_study_groups, -> { where('id IN (SELECT DISTINCT consumer_id FROM study_groups)') }
|
||||
|
||||
validates :name, presence: true
|
||||
validates :oauth_key, presence: true, uniqueness: true
|
||||
|
Reference in New Issue
Block a user