1

I have a query as follows:

events = Event.joins(:user_events).where(:user_events => { :user => user }).by_time(time)

How would I go about creating a query to find a specific object in this query?

1 Answer 1

2

The events object is ActiveRecord::Relation object, which means it's chainable.

You can further call another condition based on it.

event = events.where(id: 123)
Sign up to request clarification or add additional context in comments.

2 Comments

Do you know how I would get all of the specific id's of the events object?
Yes, events.pluck :id

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.