Articles by Romil Mehta

Rails 6.1 adds query method associated to check for the association presence

Rails 6.1 adds ActiveRecord::Relation#associated query method to check for the associated record presence

Rails 6.1 allows attribute's default to be configured but keeping its type

With Rails 6.1, we can set attribute's default value by keeping the type same

Rails 6 adds ActiveJob::TestCase#perform_enqueued_jobs without a block

With Rails 6, we can use ActiveJob::TestCase#perform_enqueued_jobs without a block to perform jobs in tests

Rails adds support for db:rollback:name for multiple database applications

Rails has added support for name option while rollbacking migration for multiple database application

Heredocs and how to use them in Ruby and Rails

What are heredoc and different ways to use them in Ruby and Rails.

Rails has added support in Action Cable to unsubscribe from specific stream

Rails adds ActionCable::Channel#stop_stream_from and ActionCable::Channel#stop_stream_for methods to allow user to unsubscribe from specific stream

Rails 6.1 adds at option to perform_enqueued_jobs test helper

Rails 6.1 has added at option to perform_enqueued_jobs test helper to run only jobs which are scheduled at or before the passed in time

Rails adds support for if_exists/if_not_exists on remove_column/add_column in migrations

Rails adds support for if_exists/if_not_exists on remove_column/add_column in migrations to silently ignore migrations

Rails 6 adds rails db:system:change command

Rails 6 adds rails db:system:change command to allow switching database configuration

Rails 6 adds ActiveSupport::ParameterFilter

Rails 6 has moved ParameterFilter from ActionDispatch to ActiveSupport in order to support filtered attributes with ActiveRecord::Relation#inspect.

Rails 6 - Action Mailbox tryout

Rails 6 has added Action Mailbox to process inbound emails. This post tries a deep dive trying to set it up

Ruby 2.7 adds inherit as an optional argument to Module#autoload?

Ruby 2.7 has added inherit as an optional argument to Module#autoload? to check if a given class or module has an autoload defined for a certain constant

Ruby 2.7 adds UnboundMethod#bind_call method

Ruby 2.7 has added bind_call method to UnboundMethods to avoid the allocation from intermediate Method object

Rails 6 adds support for multi environment credentials

Rails 6 has added support for multi environment credentials to manage environment specific credentials

Ruby 2.7 adds Integer#[] to support range values

Ruby 2.7 has extended `Integer#[]` to support range arguments which makes expressions cleaner and more readable

Ruby 2.7 adds Module#const_source_location

Ruby 2.7 has added Module#const_source_location to get the source location of a constant

Rails 6 adds dig method to ActionDispatch::Request::Session

Rails 6 has added dig method to ActionDispatch::Request::Session to easily traverse session object's nested hashes

Ruby 2.7 adds warning for Proc.new and proc without block and error for lambda without block

In Ruby 2.7 Proc.new and proc with no block in a method called with a block is warned now and lambda with no block in a method called with a block will give errors.

Ruby 2.7 adds FrozenError#receiver

Ruby 2.7 has added `FrozenError#receiver` to return the frozen object on which modification was attempted

Rails 6 adds touch_all method to ActiveRecord::Relation

Rails 6 has added touch_all method to ActiveRecord::Relation to update the updated_at timestamp of multiple records at once.

Ruby 2.7 adds Time#ceil and Time#floor methods

Ruby 2.7 adds Time#ceil and Time#floor methods to round up and down the decimal part of Time (nanosecond) to the specified digit

Ruby 2.7 adds beginless range

A beginless range is experimentally introduced in ruby 2.7.

Rails 6 adds Array#extract!

Rails 6 adds Array#extract! to remove and return the elements for which the block returns a true value.