Software engineering and personal development

Tag: ruby (Page 2 of 3)

Translate dynamic content using Globalize gem

Img source: railscasts.com

We are in an interconnected world, where people across the planet can use the projects that we develop, and having the opportunity to offer them with additional international languages make them a lot better. We can obviously use locale for doing the translations of static strings like labels, or placeholder descriptions that appear across our applications, so we should also have something that can give us a way to translate the dynamic content.  There is a really great Ruby gem that makes the translation of model attributes a lot easier. This gem is called Globalize and is very easy to use.

Continue reading

Set up your macOS development environment using Thoughtbot’s Laptop script

One of the things that may prevent us from changing or even just thinking of changing our working environments is the necessity to do all the installations and the configurations that we once set up that are needed for software development. Fortunately, there is a cure for this pain. Laptop is a script that prepares your working macOS machine for web and mobile development.

Continue reading

A very efficient way to do string concatenations in Ruby

Img source: medium.com

It is very difficult to think about an application that does not have any string data type. Names, emails, object attributes, etc. are very common. Knowing their wide usages, it is obvious that we should at least learn the best practices about them. I recently learned about the difference between the efficiency of two similar string functions, which was a bit surprising and that made me write this article. Although both methods do the concatenation of strings, there is a big difference in their performance.

Continue reading

Integrate search forms in your projects with Ransack gem

 

Img source: techbrownbags.wordpress.com

It is highly likely that you will have to work on a project that has some type of search forms implemented. Fortunately, as with many other type of functionalities that you can easily get out of the box without writing too much code in Rails projects, there is also a gem that is specific for this purpose. Ransack is a Ruby gem that enables the creation of both simple and advanced search forms for Ruby on Rails projects.

Continue reading

Debug your Ruby code using ByeBug gem

 

Img caption: medium.com

It is no doubt that one of the activities that takes most of the time of software developers is debugging. We as programmers can make many mistakes, which may lead to many bugs that need to be fixed. One of the best ways to fix these bugs, understand the flow of an application, or implement new features is through debugging. ByeBug is a great Ruby gem that helps us fix bugs and debug projects by going through each line. It is similar to pry, with additional functionalities. 

Continue reading

Add authorization restrictions in your applications using CanCan gem

Img source: railscarma.com

It is no doubt that there are certain pages that you do not need to have them viewed by all the visitors of your application. You can also have users of different roles that may not be allowed to access certain parts of your applications. There is a really good Ruby gem called cancan that excels at this. It makes the authorization of your app resources pretty straight-forward, so you do not have to duplicate permission checking code across controllers and views.

Continue reading

« Older posts Newer posts »

© 2024 Fatos Morina

Theme by Anders NorenUp ↑