How to Add Custom Labels to Active Admin Filters

Active Admin has been one of the most used Administration panel in the Ruby on Rails world. It’s so easy to use. Although, I must admit looking for the right resource for customization is pain.

Here is how to Add Custom Labels to Active Admin Filters

  filter :user_name, as: :string
  filter :user_email, as: :string, label: 'User Email'
  filter :logged_in_time, label: 'Logged In Date'
  filter :logged_out_time, label: 'Logged Out Date'

The filters would automatically use the column name appended by the table name if you are using an associated table’s field. The label field would allow you to add your own custom labels to filter.

 How to Modify the Width of a Column in Google Spreadsheet

Google Spreadsheets is probably the go to spreadsheet application for most non-windows users. Windows users probably have their trusty Microsoft Excel spreadsheet application with them. Here are a few things on managing the width of columns on Google spreadsheets.

Lengthen the width of the column

  • Hover over the line between the columns
  • Click and drag the column to meet your desired width

Auto fit the width depending on the width of the content

  • Hover of the line between the columns
  • Double-click

 How to Add a Dropdown to a Google Spreadsheet

Google Docs are awesome and there are a lot of things to learn about them. Here is a tutorial on how to add a dropdown to Google Spreadsheet

Step by Step:

  • Select the cell or cells where you want to create a drop-down list.
  • Click Data and then Data Validation.
  • In Criteria, choose the option, List of items
  • Enter items, separated by commas and no spaces.
  • Click Save. The cells you have chosen will show a dropdown list of the items you created

Video Tutorial

 React: Passing Props from one Component to another

There are some things that we just need to do to finish something fast. It’s inefficient but we can get back to later on. One of those examples is retrieving the fields you need from the database.

# Optimized way to get data 
SELECT first_name, last_name FROM users;
# Non-optimized way to get data
SELECT * FROM users;

In React, there some instances that we need to pass in props from one component to another and we are just too tired to do it right now. Here is a cool way.

Best way / Optimized

const { first_name, last_name, address } = this.props;
<ChildComponent
  first_name={first_name}
  last_name={last_name}
  address={address}
/>

Cool way / Non-optimized

<ChildComponent
 {...this.props}
/>

Remember that this isn’t the optimized thing to do

Screen shot 2017 11 15 at 8.54.00 am