#RubyOnRails – Friendly_id Gem

Ruby on Rails (or Rails) is a web development framework that gives Rails developers a time-saving method for writing code. Rails are one of many web frameworks in the world of app programming and web development. These frameworks are collections of code libraries that give app and web developers readymade solutions for time-consuming, repetitive tasks—things like building menus, tables, or forms on a website.

Rather than having to write every single line of code in a program from scratch, web developers can refer to a framework and find the code for common functions that they can plug into the websites or web apps they’re building.

Rails render individual records via their id and that is something unfriendly and unmeaningful. Developers may be looking at SEO or even having a simple of accessing a particular record would have to take additional steps to make sure that the URL is taken care of.

Introducing Friendly_id gem, created and maintained by Norman Clarke

 “FriendlyId is the “Swiss Army bulldozer” of slugging and permalink plugins for Active Record. It lets you create pretty URLs and work with human-friendly strings as if they were numeric ids.”

At the time of writing this, the gem is currently at version 5.2.5.


Add the following line to your Gemfile

Switch to the terminal and run the following


We will need to generate a configuration file for Friendly_id

Followed by creating a migration for the model that you are looking to provide a “friendly” id. I will use Book as my model and you should replace it with yours.

Next run the migration script.

Extending the model

There’s a trick here, a lot of folks on Stack Overflow is having issue extending FriendlyId. Make sure you spell it “FriendlyId” instead of “FriendlyID“, note the “D”.

If you are following so far, you have almost reach the end of the setup but if your existing model have some records, we will need to manually create the slug.

Bring up the Rails Console.

Enter the following to have it run a series of update statements.

And we are done.
I strongly recommend that you check out the github repository for other gotcha and as well as stack overflow.

You may need to update all .find() statement to friendly.find() but I will leave that you and I will not cover that.

Friendly_id – https://github.com/norman/friendly_id

Stack Overflow – https://stackoverflow.com/search?q=friendly_id+gem

Administrator Certification Maintenance (Winter ’19)

On which object can users assign a new owner to multiple records at one time from a Lightning Experience list view?

A. Leads

How can a user place the cursor in the list view search field without navigating to it with the tab button or the cursor?

C. Keyboard shortcut g+f

Which Forecast Type should the System Administrator configure to make territory forecasts available to the sales team?

C. Opportunity Revenue by Territory

How many decimal places can the user choose to display when creating a dashboard component?

D. Up to 5

What will display in the search results when a user uses the quick search on the reports tab?

D. The reports or folders displayed are based on what is selected on the side menu

The customer community manager wants to gamify the community by recognizing members’ specific accomplishments. What can the System Administrator configure to accomplish this goal?

A. Recognition Badges

What has to be enabled to allow users to save Chatter posts before they appear in the feed?

C. Allow draft posts

How can a standard user adjust the page layout to display more fields in the same amount of space?

D. Change the density from comfy to compact

Platform App Builder Certification Maintenance (Winter ’19)

Which behavior is true when using the ‘Deploy processes and flows as active’ feature?

A. Apex tests must cover 75% of all active Processes and autolaunched Flows.

How should an App Builder ensure that Users are able to see Survey responses?

C. Grant access to the Survey object then direct users to the Survey Invitations related list

How can a user share the contents of a Salesforce Folder with customers in Lightning?

B. Create a public link to a Shared Folder.

How can an App Builder configure a Guided Action to be mandatory on a record?

CSet the Is Mandatory field in a Process that launches the Flow.

Platform Developer I Certification Maintenance (Winter ’19) Work with the Lightning Map Component and Apex Inherited Sharing


public inherited sharing class TowerMapUtilClass {
public static List queryObjects(String theObject, List theFields, String theFilter, String sortField, String sortOrder) {
String theQuery = ‘SELECT ‘ + string.join(theFields, ‘,’);
theQuery += ‘ FROM ‘ + theObject;
if(!String.isEmpty(theFilter)) {
theQuery += ‘ WHERE ‘ + theFilter;
if(!String.isEmpty(sortField)) {
theQuery += ‘ ORDER BY ‘ + sortField;
if(!String.isEmpty(sortOrder)) {
theQuery += ‘ ‘ + sortOrder;
return database.query(theQuery);


public inherited sharing class TowerMapControllerClass {
public static List getAllTowers() {
String theObject = ‘Tower__c’;
List theFields = new List{‘Id’, ‘Name’, ‘State__r.Name’, ‘Tower_Location__Latitude__s’, ‘Tower_Location__Longitude__s’};
String theFilter = ”;
String sortField = ‘Name’;
String sortOrder = ‘ASC’;
List allTowers = TowerMapUtilClass.queryObjects(theObject, theFields, theFilter, sortField, sortOrder);
return allTowers;


Platform Developer I Certification Maintenance (Winter ’19)

Which method of the DescribeSObjectResult class allows you to access record types by their developer name?

D. getRecordTypeInfosByDeveloperName()

Which Apex class includes new methods to verify digital and HMAC signatures?

B. System.Crypto

Your org has My Domain enabled. What is the most efficient method to obtain a valid session ID to make an HTTP callout from asynchronous Apex code to Salesforce APIs?

B. Use System.UserInfo.getSessionId().

Which annotation allows a developer to make the result of an Apex method storable for Lightning components?

D. @AuraEnabled(cacheable=true)

Which merge field allows you to isolate untrusted third-party content with <apex:iframe> tag in Visualforce?

C. $IFrameResource

Prior to installing an unlocked package, which object should a developer query using the Tooling API to list the packages it depends on?

D. SubscriberPackageVersion