mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Revert previous commits and use collection_singular_ids=(ids) setter instead
This commit is contained in:
@@ -15,7 +15,7 @@ module Api
|
||||
user_ids = params[:enterprise].delete(:user_ids)
|
||||
@enterprise = Enterprise.new(params[:enterprise])
|
||||
if @enterprise.save
|
||||
save_enterprise_users(user_ids)
|
||||
@enterprise.user_ids = user_ids
|
||||
render text: @enterprise.id, status: :created
|
||||
else
|
||||
invalid_resource!(@enterprise)
|
||||
@@ -76,15 +76,5 @@ module Api
|
||||
def override_visible
|
||||
params[:enterprise][:visible] = false
|
||||
end
|
||||
|
||||
def save_enterprise_users(user_ids)
|
||||
return unless user_ids
|
||||
|
||||
user_ids.each do |user_id|
|
||||
next if @enterprise.user_ids.include? user_id.to_i
|
||||
|
||||
@enterprise.users << Spree::User.find(user_id)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user