I am trying to select all records that are not null from my table using the method
MyModel.where(:some_id => !nil)
but it does not work, is there any other solution for this?
Use a string, not a hash
MyModel.where("some_id is not null")
You can do this using Arel syntax (which has a database independent bonus):
MyModel.where(MyModel.arel_table['some_id'].not_eq(nil))
You can use:
MyModel.where("some_id IS NOT NULL")
Source: https://habr.com/ru/post/898520/More articles:Where are contracts for infrastructure services? - dependency-injectionHidden Windows Installer - scriptingSeparate "drawn" objects in Mathematica - wolfram-mathematicaJava class dynamically with the Constructor parameter - javaHow to set CAP_SYS_NICE features for Linux user? - linuxHow can I use the HierarchicalDataTemplate to display XML elements and attributes? - wpfDistinguish individual dialogs using DialogInterface.OnClickListener - javaCan I change va_list before passing it? - objective-cHow to enable logging in a Perl module? - loggingGet all identifiers from the collection - ruby | fooobar.comAll Articles