Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Chatroom < ApplicationRecord
- has_many :subscribers, dependent: :destroy
- end
- class ChatroomsController < ApplicationController
- # GET /chatrooms
- def index
- @chatrooms= Chatroom.all.includes(Subscriber.where("subscriber.created_at < ?", Time.now).order('created_at DESC').first)
- render json: @chatrooms
- end
- end
Add Comment
Please, Sign In to add comment