Class: Decidim::OpenDataController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/decidim/open_data_controller.rb

Instance Method Summary collapse

Instance Method Details

#downloadObject



9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/decidim/open_data_controller.rb', line 9

def download
  resource = params[:resource] || nil

  if open_data_file_for_resource(resource)
    file = open_data_file_for_resource(resource)
    send_data file.download, filename: file.blob.filename.to_s, type: file.blob.content_type
  else
    schedule_open_data_generation(resource)
    flash[:alert] = t("decidim.open_data.not_available_yet")
    redirect_back_or_to(open_data_path)
  end
end

#indexObject



7
# File 'app/controllers/decidim/open_data_controller.rb', line 7

def index; end