add transactions controller
This commit is contained in:
parent
f2bc39b2b6
commit
993a54bd46
9 changed files with 50 additions and 0 deletions
3
app/assets/javascripts/transactions.coffee
Normal file
3
app/assets/javascripts/transactions.coffee
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Place all the behaviors and hooks related to the matching controller here.
|
||||||
|
# All this logic will automatically be available in application.js.
|
||||||
|
# You can use CoffeeScript in this file: http://coffeescript.org/
|
3
app/assets/stylesheets/transactions.scss
Normal file
3
app/assets/stylesheets/transactions.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
// Place all the styles related to the transactions controller here.
|
||||||
|
// They will automatically be included in application.css.
|
||||||
|
// You can use Sass (SCSS) here: http://sass-lang.com/
|
14
app/controllers/transactions_controller.rb
Normal file
14
app/controllers/transactions_controller.rb
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
class TransactionsController < ApplicationController
|
||||||
|
|
||||||
|
def index
|
||||||
|
@transactions = Transaction.all
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@transaction = Transaction.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
2
app/helpers/transactions_helper.rb
Normal file
2
app/helpers/transactions_helper.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
module TransactionsHelper
|
||||||
|
end
|
3
app/views/transactions/index.html.erb
Normal file
3
app/views/transactions/index.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
Oh cool a list of transactions
|
||||||
|
|
3
app/views/transactions/new.html.erb
Normal file
3
app/views/transactions/new.html.erb
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
|
||||||
|
Hello, new transaction
|
||||||
|
|
|
@ -5,6 +5,8 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
root to: 'high_voltage/pages#show', id: "landing"
|
root to: 'high_voltage/pages#show', id: "landing"
|
||||||
|
|
||||||
|
resources :transactions, only: [:new, :index, :create]
|
||||||
|
|
||||||
# The priority is based upon order of creation: first created -> highest priority.
|
# The priority is based upon order of creation: first created -> highest priority.
|
||||||
# See how all your routes lay out with "rake routes".
|
# See how all your routes lay out with "rake routes".
|
||||||
|
|
||||||
|
|
5
spec/controllers/transactions_controller_spec.rb
Normal file
5
spec/controllers/transactions_controller_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
RSpec.describe TransactionsController, type: :controller do
|
||||||
|
|
||||||
|
end
|
15
spec/helpers/transactions_helper_spec.rb
Normal file
15
spec/helpers/transactions_helper_spec.rb
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
# Specs in this file have access to a helper object that includes
|
||||||
|
# the TransactionsHelper. For example:
|
||||||
|
#
|
||||||
|
# describe TransactionsHelper do
|
||||||
|
# describe "string concat" do
|
||||||
|
# it "concats two strings with spaces" do
|
||||||
|
# expect(helper.concat_strings("this","that")).to eq("this that")
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
# end
|
||||||
|
RSpec.describe TransactionsHelper, type: :helper do
|
||||||
|
pending "add some examples to (or delete) #{__FILE__}"
|
||||||
|
end
|
Loading…
Reference in a new issue