Ruby on Rails
Friday, April 8, 2016
You can achieve this with:
-- <%
@friended = current_user.profile.friendables.where("from_id = :user_id OR to_id = :user_id", user_id: current_user.id).where(accepted: true)
%>
On Thursday, April 7, 2016 at 6:15:53 PM UTC+3, fugee ohu wrote:
On Thursday, April 7, 2016 at 6:15:53 PM UTC+3, fugee ohu wrote:
I need to select where column = (this||that) and someothercolumn=something
<% @friended = current_user.profile.friendables.where("(from_id = ? OR to_id = ?) AND accepted = true)", current_user.id, current_user.id) %>
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/0ecd9483-90f3-4d03-aff2-d8d6b28df623%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment