Rails try hash key access Rails ActiveSupport provides try method on an object. Try is used to call a method on an object if it is not nil, otherwise return nil. Try method also be used on a
Rails + React JS application with CRUD operation Setting up Rails application with ReactJS usually takes some time. Setting up React Router and Redux for Front-end is an essential part of using React with Ruby on Rails.
Rails Routes expanded view option Listing rails routes and interpreting is quite troublesome if you are using a small screen on terminal. Rails 6 adds support to show rails routes in an expanded format with --expanded option.
Rails find_in_batches vs find_each Often, we come across querying in batches to fetch records through ActiveRecord in Rails. This article discusses how we can use find_in_batches and find_each to query records in batches with ActiveRecord.
Override Devise Mailer in Rails The other day, I had to override devise confirmation instructions email. Particularly, subject of the email being sent out from Devise. Devise makes it easy to override subject of the mail, with devise.en.yml
Override as_json in Rails When we call as_json on ActiveRecord model object, it returns json of attributes on model by calling as_json. We can override as_json method and add extra attributes, rename keys, add values of methods