Ruby Gem ActiveRecord find method with multiple conditions

Viewed 11551

I'm building a Sinatra application using three database's tables: user, post and like.

I'd want to run a query that will find an entry in the like table like so:

FIND in like WHERE user_id == params[:user_id] AND post_id == params[:post_id]

(for one condition I'll be using: Like.find_by_user_id(params[:user_id]))

My question is:

How to run a find query with multiple conditions using the ActiveRecord Gem?

4 Answers
Related