I’m having some trouble with a .where statement in rails. Can anybody help?
<% due_late = project.tasks.where(":date_due < ?", Date.today).count %>
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.
date_duein this context is the column name as defined in the database, not the Ruby symbol:date_due.Update after comments
It is necessary to differentiate the table name in a
JOINquery if both tables have the same column name:As a point of advice, rather than perform this calculation in the view .erb file, it would be better to create a method in the model which returns the value.
Called in the view as