Suggestions On Redis, Backing-Up Redis And Setting up production environment for redis

Redis installation at local is one of the easiest things to do. However, There are some gotchas involved when we are trying to use redis. Running redis-server without config(Default Config File will be picked). When we run redis-server without config, then it creates a dump.rb(A physical file to store all data related to redis) at the folder from which we are starting the redis. We normally, don't realize the impact of this issue as we start the redis server at the same project folder every-time. However, If we start the redis from the some other folder, then

Alternative way to highlight the current active page

This post is very much similar to the post of Abhijit. [Highlight the active page (Highight the active page)][1] by Abhijit. This would work very well if we have simpler routes, if we have complex routes(Modular routes) in our app where we have similar urls with same action then we need to enhance this approach. For e.g There are three links on the same page as follows. 'web/dashboard' 'mweb/dashboard' 'mapp/dashboard' All these are pointing to same action. i.e Dashboard. So selecting active tab based on action name will fail here and will highlight

Active Admin - adding custom search(outside the resource model)

In ActiveAdmin, if your resource model is deriving some data from other models, using some kind of relationship(has_one or has_many). In this scenarios where you want to search and filter the resource based on the data in its related table, you can follow below: Suppose you have a model School, and a model Student, now you want to search or filter students based on the school name. We can filter using join(:schools).where("schools.name like") or say an In Query which is inefficient. Either way ActiveAdmin does not provide default filters based on

Nested Forms

Feature is used when you need to save your nested model with the parent model. Use-Case: Suppose you have a model say Person and it can be associated with N number of Contacts. Using nested form we can associate 1..n contacts to the person. Approach: For associating a contact to a person, we need to build the contact model with respect to the person model. For has_many relation, @contact = @person.contacts.build and if has_one relation @contact = @person.build_contact. Now we can use the @contact in the view, for this we use fields_for tag. And

Setting attribute values in active records.

This is an awesome link on how to setup attributes on ActiveRecord LINK: 5-ways to set attributes And I want to mention one trick about active record: When we try to assign a value to active record object like class A In case of any queries, post your queries in comments.