Mike's Blog

Passing on knowledge about software development and other related technologies.

Seeding your database in Rails - Part 2

Seeding database

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

Why Visual Studio Code?

Opengraph home

After navigating through using several other cross-platform editors over the last few years, my mind always kept going back to the best tool Microsoft ever conceived, Visual Studio. As most developers do working on multiple platforms, I started off on Sublime (which is an awesome tool but a bit clunky by today's standards IMHO) when there wasn't much more available. Then, when Atom came along I gave it a try, but it was painfully slow to work with on a daily basis. Of course, I also dabbled with using very barebone VIM and EMACS setups which were just not my preference. That’s th... Continue reading

Google Chrome Add-On's Every Web Developer Needs

Add ons web developer

I was thinking the other day about the tools I use on a daily basis when doing web development and decided to do do a short post on my "go-to" Chrome add-on's. These are popular but somewhat simplistic tools that are small, fast and don't get in your way until you need to use them. So let's get started!

CSS Peeper
Ever wondered what’s the line-height, font or a button size on a website? This add-on provides you the tools to satisfy your curiosity. Yo... Continue reading

Seeding your database in Rails - Part 1

Seeding database

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

CleanTalk for CMS

Wordpress screen

I am not one to easily recommend software services (SaaS). Especially when it comes to services that help secure your site but I have to brag on CleanTalk. If you manage or own a Wordpress, Drupal, Joomla, or another CMS or Forum package you need CleanTalk.

What is Cleantalk? CleanTalk is anti-spam protection (via a plug-in or can integrate into your site via their API) that protects login, comments, and forms on your site. CleanTalk is a transparent anti-spam protection and detailed statistics for each of your sites you use it on.

It has worked better at keeping spammer... Continue reading