Class: Tiler::DataSourcesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Tiler::DataSourcesController
- Defined in:
- app/controllers/tiler/data_sources_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #destroy ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 19 def create @data_source = DataSource.new(source_params) if @data_source.save redirect_to data_source_path(@data_source), notice: "Data source created." else render :new, status: :unprocessable_entity end end |
#destroy ⇒ Object
39 40 41 42 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 39 def destroy @data_source.destroy! redirect_to data_sources_path, notice: "Data source removed." end |
#edit ⇒ Object
28 29 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 28 def edit end |
#index ⇒ Object
6 7 8 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 6 def index @data_sources = DataSource.by_name end |
#new ⇒ Object
14 15 16 17 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 14 def new @data_source = DataSource.new(active: true, ingestion_methods: [ "webhook", "manual" ].to_json) end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 10 def show @recent = @data_source.data_records.order(recorded_at: :desc).limit(25) end |
#update ⇒ Object
31 32 33 34 35 36 37 |
# File 'app/controllers/tiler/data_sources_controller.rb', line 31 def update if @data_source.update(source_params) redirect_to data_source_path(@data_source), notice: "Data source updated." else render :edit, status: :unprocessable_entity end end |