Class: Nquery::ChartsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Nquery::ChartsController
- Includes:
- ChartActions
- Defined in:
- app/controllers/nquery/charts_controller.rb
Constant Summary
Constants included from AuthorizesCollection
AuthorizesCollection::COLLECTION_REQUIREMENTS
Instance Method Summary collapse
Methods included from ChartActions
#archive, #destroy, #edit, #embed, #show, #update
Methods included from Breadcrumbs
#breadcrumbs, #set_breadcrumbs
Instance Method Details
#create ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/nquery/charts_controller.rb', line 16 def create @chart = Chart.new( chart_params.merge( creator: current_nquery_user, collection: @root_collection ) ) @chart.name = @chart.name.presence || @chart.query&.name @chart.visualization = { "type" => "table" } if @chart.visualization.blank? @chart.query&.creator = current_nquery_user @chart.query&.collection = @root_collection if @chart.save redirect_to edit_chart_path(@chart), notice: "Chart created." else load_chart_builder_assigns render :new, status: :unprocessable_content end end |
#new ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/nquery/charts_controller.rb', line 10 def new @chart = Chart.new @chart.build_query(statement: "SELECT 1 AS example") load_chart_builder_assigns end |