:messages, controller: MessagesController end class MessagesController < ApplicationController def index(repo_id) repository = Repository.find(repo_id) if repository.present? messages = Message.where(repository: repository) t[:ok, { messages: messages.map(&:to_hash) } ] else t[:not_found, { error: "Repository not found" } ] end end end