Refactor EnterpriseSet to accept a collection as an argument

This commit is contained in:
Rob Harrington
2014-11-06 16:29:09 +11:00
parent b27a0986b7
commit 51e768e722
2 changed files with 4 additions and 4 deletions

View File

@@ -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

View File

@@ -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