I recently had an issue with Rails Admin, which was displaying duplicate models in the left hand side menu. It was something that I had not encountered before, and it turned out, it was a rare occasion, as I could not find that much coverage about it. I also saw that this unanswered question related to this problem was published more than a year and a half ago in StackOverflow. This is the reason why I decided to write this post. Continue reading
Category: Science & Tech (Page 31 of 35)
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.
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.
It’s no doubt that we are using our devices almost all the time, especially before going to bed. Screens produce blue light, which mimics the sunlight and sends mixed signals to our brains about the bed time. As a result, we may not be able to sleep, even though we have put the head on the pillow thirty minutes ago. F.lux is a free app for Mac, Windows, Linux, Android, and iPad, which fixes this: It regulates the screen color of your device and mimics the sunlight during the day, and indoor-like lights during the night.
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.
It’s obvious that a lot of applications need an admin panel, where the administrator or other lower level users need privileges to do certain data manipulations. Not everyone of them should be a technical person. Thus, you may need to provide them a user-friendly interface which gives them this opportunity. Fortunately, you can insert an admin panel in your Rails application easily using RailsAdmin.
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.
GitHub is widely known as one of the most famous version control repository, in which you can find pretty much countless public projects for many programming languages. It makes it easy for you to collaborate with your team members, and also with other fellow developers around the globe with many public projects that you can learn and benefit from, and also contribute to. Among many other things, GitHub displays Trending Projects which make it easy for you to differentiate the projects that have received more attention than others. As a result, you have the ability to find projects that have received a lot of stars from other fellow developers in the recent past. Continue reading
You may sometimes need to make sure two files are equal, but do not know how to do it. For example, you may need to make sure two images, PDFs or two pieces of text are equal, but find it very difficult to do it manually. There is a really simple tool that I personally use that I find it really helpful. Continue reading
Rails controllers have callbacks that can be useful when we want to execute a particular piece of code before or after other methods have been invoked. However, there is no Rails built-in after_response_sent callback that could be used to invoke a method after we have rendered the response to the user, either via an HTML or JSON response. Continue reading