Guest User

Untitled

a guest
Feb 24th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. class Chatroom < ApplicationRecord
  2. has_many :subscribers, dependent: :destroy
  3. end
  4.  
  5. class ChatroomsController < ApplicationController
  6. # GET /chatrooms
  7. def index
  8. @chatrooms= Chatroom.all.includes(Subscriber.where("subscriber.created_at < ?", Time.now).order('created_at DESC').first)
  9. render json: @chatrooms
  10. end
  11. end
Add Comment
Please, Sign In to add comment