Forward Advance Learning

Integrating Gems

One of the great strengths of Rails is the community that exists around it. Rails folks are typically friendly, and willing to share and collaborate.

Third party libraries come bundled as gems. You reference these in your Gemfile, and can then make use of them. The quality of documentation is variable, but for the larger community supported gems typically have very supportive communities, and excellent documentation.

If you are using Rails, you may wish to consider contributing back to the community, perhaps by contributing bug fixes, or perhaps by releasing some of your code.

Picking a gem

You need to be a bit careful when choosing a gem to help you. They are of variable quality. Some are stronger than others.

A useful tool here is the Ruby Toolbox This is a list of community submitted gems. You can search by name and category. What you are looking for is a gem which is active and widely deployed. Such gems will be more future proof.

Login / Auth

Authorisation is typically handled using a gem called Devise. This gem handles authorisation logic, it can secure resources and routes, and can deal with things like login and password retrieval.

Styling / CSS

We have gem wrappers for Twitter Bootstrap and Zurb Foundation, as well as many other CSS frameworks

Exercise - Integrate the Zurb Foundation Gem

Zurb Foundation is a CSS / JS library of common components. It helps you style forms, headers, and many other interactions. It emphasises clean HTML and CSS without too many classes and nested elements.

Follow the Readme here to integrate Zurb with your project -

Create a simple layout for your application with a header, nav bar and footer.

Exercise - Integrate the Devise gem

Devise is an authorisation gem that has integration with OAuth and OmniAuth

Hit up the readme here and add login to your users