Retryable is another handy gem that lets you repeat a code block after an exception has happened. It has a really easy syntax, and comes with many customizations, that make it a great tool to use, especially when you have to work with web services.
Page 34 of 55
Developers may feel they do not have that much creativity when it comes to use random words as arguments, or values for many fields. For example, if we have some test cases when we are creating a new instance of a Book object, chances are that we will assign ‘book’ to this object’s title, which does not seem that much interesting. We code because it is something that gives us pleasure, and getting help with these types of difficulties can be helpful. Fortunately, there is a Ruby gem called Faker that generates random fake value that you can use in your tests.
When you select multiple column values using pluck method of ActiveRecord, you usually get an array of arrays. If you want to get an array of hashes with column names as hash keys, you can use this useful Gem called pluck_to_hash.
We mostly live our lives on autopilot habits that determine the outcomes that we have. From the moment we wake up (even while sleeping), until we go to bed we repeat certain habits that we do not pay that much attention. This does not necessarily mean that these habits are bad. It shows, however, how important it is for us to take the time and form new habits that produce remarkable results.
Redmine is a flexible project management web application that is open source, written in Ruby on Rails. If you need to start using it for your own projects, then chances are you need to deploy it to a server. In this article, you can see how to deploy the current latest stable version of Redmine to Heroku, as it sometimes can be a bit problematic. Continue reading
You may have cases when you may need to do some authorizations for certain pages, so that they cannot be accessed by unauthorized clients. There are many authorization ways that you can use in a Ruby on Rails application. In this article, I will mention one very simple, yet not that much famous method that comes implemented and ready to be used each time you create a new Rails application. Continue reading
I recently had the pleasure to publish my first article at Scotch.io, which is a very popular platform. It is one of the longest articles that I have written so far. It is a written tutorial on how to build a cryptocurrency site in which you can see the changes of values of BitCoin, Ethereum and NasDaq overtime. The project accompanying this article is developed with Ruby on Rails using Test-Driven Development (TDD). Continue reading
Comma Separated Values (CSV) files represent some commonly used files. You may have a CSV file generated from a report generated, and then you may need to write a Ruby method or task to insert it into the database. Continue reading
I recently had to upload an image to an API endpoint in Rails, and did not found that much material online, so I decided to write this article describing how I managed to do this.
I was building an API that had to interact with an authentication micro service, where the request parameter was a Multipart image of a user file that should then be encoded in base 64 and get uploaded to AWS. Continue reading
It is no surprise that you may need to work with different programming languages, or at least use many methods. You may not be sure how do you call a method, how many parameters does it have, or the type of objects for each parameters. During these cases, having a quick look up on the API documentation helps you immensely. Continue reading