Passing on knowledge about software development and other related technologies.
This is the first in a series of blog posts on development gems for Rails. I am assuming you know what gems are and their value in the Ruby/Rails ecosystem. If you don't, then here is a link to go check out.
Development gems are used during the development process only and not in production environments. The gems mentioned in this and in the next few posts are my favorites and really help get the work done when developing rails application. Let's get started.
This first post I will be focusing on the
In the first post about the seeds.rb file we covered the basics of how the seeds.rb file works. In this post, we will be looking at practical examples of how to use the seeds.rb file in a production situation. There are several issues you may have to deal with using the seeds.rb file in a project. First is determining if your data you are about to add to the database already exists. Let look at how we can do this.
first_or_create and find_or_create_by
There are two methods in Active Record that can be helpfu... Continue reading
When writing applications in Rails that use databases (as most do), we often have the need to populate small "reference" tables with data (like credit card types, colors, dog breeds, categories, etc) used in form drop-downs, test data when developing or inserting specific records into the database at deployment time. This is accomplished in Rails with the seeds.rb file located in the DB directory of your rails project folder. Surprisingly, most new Rails developers do not know about this file. If you open the file seeds.rb file in Rails 5.x you will see some examples of how you... Continue reading
First let me note that I am in no way associated with JetBrains (the developers of RubyMine), just a loyal customer. As a long time developer on many platforms I have always thought Visual Studio was the most mature and well thought out IDE (Integrated development Environment) out "in the wild". Many products have tried to copy it's success across many different platforms but none has impressed me as much as RubyMine has since I started writing Ruby and Rails applications.
What makes RubyMine so special? Well lots of things, but most of all it helps you to be PRODUC... Continue reading