Skip to content
This repository has been archived by the owner on Aug 13, 2019. It is now read-only.

Set is a built-in ruby class and should not be overwritten #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions bin/gaps_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -267,14 +267,14 @@ def die(msg)
## Suggested Sets

get '/sets', auth: true do
@sets = Gaps::DB::Set.find_each
@sets = Gaps::DB::GroupSet.find_each
erb :sets
end

post '/sets', auth: true do
set_id = params[:set]
log.info('Adding user to subscription set', set: set_id, user: @user.email)
Gaps::DB::Set.find(set_id).groups_.each do |group|
Gaps::DB::GroupSet.find(set_id).groups_.each do |group|
membership = @user.group_member?(group)
through_list = @user.group_member_through_list(group)
direct_membership = membership && !through_list
Expand All @@ -295,7 +295,7 @@ def die(msg)

get '/sets/:id', auth: true do
if params[:id] != 'new'
@set = Gaps::DB::Set.find(params[:id])
@set = Gaps::DB::GroupSet.find(params[:id])
return not_found unless @set
end
@groups = Gaps::DB::Group.categorized(@user)
Expand All @@ -310,9 +310,9 @@ def die(msg)
}

if params[:id] == 'new'
Gaps::DB::Set.new(args).save
Gaps::DB::GroupSet.new(args).save
else
set = Gaps::DB::Set.find(params[:id])
set = Gaps::DB::GroupSet.find(params[:id])
return not_found unless set

old_groups = set.groups
Expand Down
2 changes: 1 addition & 1 deletion lib/gaps/db/set.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Gaps::DB
class Set < Base
class GroupSet < Base
set_collection_name 'set'

key :name, String
Expand Down