I have two models, Word and Log. A Word has one Log, and a Log belongs to one Word. Not all Words have a Log.
How can I select all the Words that have a Log using Activerecord in Rails?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will perform a right join on logs which will remove all entries that do not have a log.
This is assuming you’re using Rails 3 or later.