Learning

Blog & Tutorials

Keep yourself up to date with our articles on Ruby on Rails, Ruby, Dart & Flutter.

Rails 5 adds OR Activerecord method

rails-5 ruby-on-rails

This or method was introduced in Rails 5, It returns a new ActiveRecord::Relation which is logical union or two relations....

Descendants vs Subclasses in Ruby

Ruby Rails

Descendants has been a part of Rails ActiveSupport::DescendantsTracker for quite a while. However, Class#subsclasses is recently introduced in Ruby 3.1...

Ruby 3.1 adds subclasses method

Ruby

Ruby 3.1 adds Class#subclasses method, which returns an array of subclasses directly inheriting from the receiver, not including singleton classes....

How to query records which has missing associations in Rails 6

rails-6 ruby-on-rails

Rails 6 provides a simpler way to query the records which does not have any associated records or orphan records...

Rails 7 adds ActiveRecord::QueryMethods#in_order_of

rails-7 ruby-on-rails

Rails 7 adds method in_order_of in QueryMethods, this allows you to specify an explicit order for the records. Example usage...

Rails 7 adds ActiveRecord::FinderMethods#sole

rails-7 ruby-on-rails

Rails 7 adds method sole and find_sole_by in ActiveRecord::FinderMethods, which enables you to get sole or single record by the...