mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-10 03:30:22 +00:00
Refactor EnterpriseSet to accept a collection as an argument
This commit is contained in:
@@ -42,7 +42,7 @@ module Admin
|
||||
end
|
||||
|
||||
def bulk_update
|
||||
@enterprise_set = EnterpriseSet.new(params[:enterprise_set].merge collection: collection)
|
||||
@enterprise_set = EnterpriseSet.new(collection, params[:enterprise_set])
|
||||
if @enterprise_set.save
|
||||
flash[:success] = 'Enterprises updated successfully'
|
||||
redirect_to main_app.admin_enterprises_path
|
||||
@@ -67,7 +67,7 @@ module Admin
|
||||
private
|
||||
|
||||
def load_enterprise_set
|
||||
@enterprise_set = EnterpriseSet.new :collection => collection
|
||||
@enterprise_set = EnterpriseSet.new collection
|
||||
end
|
||||
|
||||
def load_countries
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class EnterpriseSet < ModelSet
|
||||
def initialize(attributes={})
|
||||
super(Enterprise, Enterprise.all, nil, attributes)
|
||||
def initialize(collection, attributes={})
|
||||
super(Enterprise, collection, nil, attributes)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user