0

I have two objects that I want my index action to return, but I'm struggling to find the syntax to return them both at the same time.

def index
      last_day_for_jack = Tacobell.where(owner: "Jack")
      last_day_for_pete = Tacobell.where(owner: "Pete")
      render json: { last_day_for_jack last_day_for_pete }
  end
Jack Collins
  • 339
  • 1
  • 2
  • 13
  • Make it an array, for example: `render json: [last_day_for_jack, last_day_for_pete]` – Sergio Tulentsev Nov 07 '19 at 16:42
  • 1
    Possible duplicate of [Ruby on Rails - Render JSON for multiple models](https://stackoverflow.com/questions/4318962/ruby-on-rails-render-json-for-multiple-models) – sam Nov 07 '19 at 16:42

0 Answers0