show specific homie details

This commit is contained in:
Bilal
2020-10-10 00:35:13 +03:00
parent 6f9fceccd7
commit 2ad88ea336

View File

@@ -1,10 +1,21 @@
class HomiesController < ApplicationController
def index
homies = Homie.where(gang: params[:gang_id]).order(importance: :desc, name: :asc)
# json_response(Homie.all.order(importance: :desc, name: :asc))
json_response homies
end
def show
homie = Homie.find(params[:homie_id])
if homie
json_response homie
else
error_response :bad_request
end
rescue StandardError
error_response :bad_request
end
def create
homie = Homie.new(homie_params)
if homie.save