This repository has been archived by the owner on Jul 27, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7c5f03c
commit 739e075
Showing
20 changed files
with
106 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
class AppBinsController < ApplicationController | ||
before_action :set_app_bin | ||
|
||
def show | ||
end | ||
|
||
def new | ||
@app_bin = AppBin.new | ||
end | ||
|
||
def create | ||
if @app_bin = AppBin.create | ||
redirect_to @app_bin.reload | ||
else | ||
render :new | ||
end | ||
end | ||
|
||
private | ||
|
||
def set_app_bin | ||
@app_bin = AppBin.find_by app_key: params[:id] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
class ApplicationHelper | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
class AppBin < ApplicationRecord | ||
has_many :cycle_transactions | ||
has_many :system_health_samples | ||
|
||
before_create :generate_app_key | ||
|
||
def to_param | ||
app_key | ||
end | ||
|
||
private | ||
|
||
def generate_app_key | ||
self.app_key = SecureRandom.urlsafe_base64 | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
class SystemHealthSample < ApplicationRecord | ||
belongs_to :app_bin | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
= form_for @app_bin do |f| | ||
= f.submit 'Create a new bin' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
= @app_bin.to_param |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
!!!5 | ||
%html | ||
%head | ||
%title Tracebin | ||
= csrf_meta_tags | ||
= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' | ||
= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' | ||
|
||
%body | ||
= yield |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
!!!5 | ||
%html | ||
%head | ||
%meta(http-equiv="Content-Type" content="text/html; charset=utf-8") | ||
%style | ||
-# Email styles need to be inline | ||
%body | ||
= yield |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
= yield |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
Rails.application.routes.draw do | ||
root to: 'app_bins#new' | ||
|
||
resources :reports, only: [:create] | ||
resources :app_bins, only: [:show, :create] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
class CreateAppBins < ActiveRecord::Migration[5.0] | ||
def change | ||
create_table :app_bins do |t| | ||
t.string :app_key, unique: true, index: true | ||
|
||
t.timestamps | ||
end | ||
|
||
add_reference :cycle_transactions, :app_bin, foreign_key: true, index: true | ||
end | ||
end |
5 changes: 5 additions & 0 deletions
5
db/migrate/20170414154850_add_app_bin_reference_to_system_health_samples.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddAppBinReferenceToSystemHealthSamples < ActiveRecord::Migration[5.0] | ||
def change | ||
add_reference :system_health_samples, :app_bin, foreign_key: true, index: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters