app/controllers/digital_assets_controller.rb in daengine-0.6.16 vs app/controllers/digital_assets_controller.rb in daengine-0.6.17
- old
+ new
@@ -46,15 +46,15 @@
da.delete
head :ok
end
def updated_time
- ids = params[:ids]
- updated_time = Hash.new
- ids.each do |id|
- da = DigitalAsset.where(:digital_asset_id => id)
- updated_time[id] = da[0].doc_changed_at if da.present?
+ if(params[:ids].present?)
+ assets = DigitalAsset.where(:digital_asset_id.in => params[:ids])
+ else
+ assets = DigitalAsset.all
end
+ updated_time = Hash[assets.map{|a| [a.digital_asset_id, a.doc_changed_at]}]
render json: updated_time.to_json, status: :ok
end
def fund_docs
@digital_assets = []