Friendly_ID Tutorial Released for Ruby on Rails

A new tutorial has been released explaining how to set up friendly_id for Ruby on Rails. This is a free-to-use gem which has garnered a lot of support due to its simple and effective way of helping create canonical URL's (domain.com/resource).
 
BROMBOROUGH, U.K. - June 4, 2017 - PRLog -- A new tutorial has been released showcasing how to use "friendly_id" with Ruby on Rails. This gem has been popular for a large number of years, due to its simplicity in setting up "canonical" URLs for Rails-powered web applications (domain.com/your-resource). The tutorial explains in as simple terms as possible the ability for a developer to add this gem to their application.

The friendly_id gem helps build something called "canonical URLs". These translate "slugs" into id's that can be used by ActiveRecord to search for records. Although you can do this manually, the main benefit of using friendly_id is that it replaces a number of core Rails functions which would otherwise have to be manually overwritten. This not only allows for a simple transition, but also ensures you don't need to rewrite any of your core code if you decide to remove the gem.

There are two features of friendly_id which make it effective:

- Maintain your frontend route helpers
- Replaces the find/find! methods to automatically detect slugs

The way friendly_id works is to add a number of features to several core Rails functions. These features allow you to still call the same route helpers and backend methods (in the controller), thus allowing you to maintain your application's validity. The main difference is that it adds a "slug" attribute to model objects, which it basically uses to replace the "id" (primary key) column when looking up new URLs etc.

If you have a Rails application and want to use URLs such as domain.com/pages/about or domain.com/support/1-knowledgebase-how-to, you'll want to look at adding friendly_id to your Rails gemfile. The tutorial created by Frontline Utilities LTD explains how to do this:

https://medium.com/ruby-on-rails-web-application-developm...

End
Source: » Follow
Email:***@frontlineutilities.co.uk Email Verified
Tags:Friendly, id, Rails
Industry:Computers
Location:Bromborough - Wirral - England
Subject:Websites
Account Email Address Verified     Account Phone Number Verified     Disclaimer     Report Abuse
Frontline Utilities LTD PRs
Trending News
Most Viewed
Top Daily News



Like PRLog?
9K2K1K
Click to Share