How can I translate this MySQL WHERE to ActiveRecord: condition?
SELECT * FROM users WHERE LENGTH(users.last_name) < 3
Thank!
User.find(:all, :conditions => ["LENGTH(last_name) < ?", 3])
or you can use find_by_sql
User.find_by_sql("SELECT * FROM users WHERE LENGTH(users.last_name) < 3")
Source: https://habr.com/ru/post/1752404/More articles:Match geographic coordinates based on degrees with regex - regexException when trying to debug a project from the IDE, but not when starting outside the IDE - c #How to detect failover mail in Google App Engine? - pythonJava - dynamic compilation without JDK - javarails - redirection when the user manually enters the wrong URL - ruby | fooobar.comI'm looking for a C ++ wrapper around Perl inline functions - c ++C ++ for checking monophonic pointers - c ++Adding and Retrieving from KeyedCollection - collectionsHow to enable exception handling in objective-c and xcode - gccGood code spelling for Visual Studio 2010 - visual-studio-2010All Articles