Homies and money moves
This commit is contained in:
2
app/controllers/homies_controller.rb
Normal file
2
app/controllers/homies_controller.rb
Normal file
@@ -0,0 +1,2 @@
|
||||
class HomiesController < ApplicationController::API
|
||||
end
|
||||
23
app/controllers/money_moves_controller.rb
Normal file
23
app/controllers/money_moves_controller.rb
Normal file
@@ -0,0 +1,23 @@
|
||||
class MoneyMovesController < ApplicationController::API
|
||||
def list
|
||||
json_response(MoneyMove.find(:all).order(:created_at))
|
||||
end
|
||||
|
||||
def create
|
||||
money_move = MoneyMove.new(money_move_params)
|
||||
if money_move.save
|
||||
json_response(money_move)
|
||||
else
|
||||
error_response(:bad_request)
|
||||
end
|
||||
end
|
||||
|
||||
def money_move_params
|
||||
params.require(:money_moves).permit(
|
||||
:description,
|
||||
:amount,
|
||||
:from_homie_id,
|
||||
:to_homie_id
|
||||
)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user