Querying with ActiveRecord in Ruby
ActiveRecord is versatile enough to provide you with passing SQL fragments for more elaborate quering of your database. ActiveRecord uses where method to accomplish this task. There are two different flavors of using where method in Ruby
MyObject.where(“name= ?”, ‘James Wood’)
MyObject.where(name: ‘James Wood’)
It is possible to create a class using where method that does more complex data retrieval querying from the database. Some of these types of implementations are available as gems some you can simply write yourself.