chat-app/backend/app/controllers/rooms_controller.rb

18 lines
297 B
Ruby
Raw Normal View History

2025-02-15 22:16:39 +09:00
class RoomsController < ApplicationController
def index
rooms = Room.all
render json: rooms, status: :ok
end
def create
room = Room.create(room_params)
render json: room, status: :created
end
private
def room_params
params.require(:room).permit(:name)
end
end