merge remote branch into transaction-vc
This commit is contained in:
commit
15ba18fa59
4 changed files with 25 additions and 2 deletions
|
@ -12,6 +12,10 @@ class TransactionsController < ApplicationController
|
|||
end
|
||||
|
||||
def create
|
||||
creditor = User.find params.require(:transaction).require(:creditor)
|
||||
debtor = current_user
|
||||
amount = params.require(:transaction).require(:amount)
|
||||
@transaction = Transaction.create debtor: debtor, creditor: creditor, amount: amount, origin: I18n.t('origin.created_by_user'), message: "Transaction by #{debtor.name} to #{creditor.name}"
|
||||
end
|
||||
|
||||
end
|
||||
|
|
17
app/views/transactions/create.html.haml
Normal file
17
app/views/transactions/create.html.haml
Normal file
|
@ -0,0 +1,17 @@
|
|||
%table
|
||||
%tbody
|
||||
%tr
|
||||
%th Debtor
|
||||
%td= @transaction.debtor.name
|
||||
%tr
|
||||
%th Creditor
|
||||
%td= @transaction.creditor.name
|
||||
%tr
|
||||
%th Amount
|
||||
%td= @transaction.amount
|
||||
%tr
|
||||
%th Origin
|
||||
%td= @transaction.origin
|
||||
%tr
|
||||
%th Message
|
||||
%td= @transaction.message
|
|
@ -1,4 +1,4 @@
|
|||
= form_for @transaction do |f|
|
||||
= f.select :creditor, User.all, {}, { class: 'select2-selector' }
|
||||
= f.collection_select :creditor, User.all, :id, :name, {}, { class: 'select2-selector' }
|
||||
= f.number_field :amount
|
||||
= f.submit "Send it!"
|
||||
|
|
|
@ -20,4 +20,6 @@
|
|||
# available at http://guides.rubyonrails.org/i18n.html.
|
||||
|
||||
en:
|
||||
hello: "Hello world"
|
||||
origin:
|
||||
created_by_user: "User"
|
||||
|
||||
|
|
Loading…
Reference in a new issue