Rails 5.2 Has And Belongs To Many with UUID

Standard

When using UUIDs and you are creating a join table like so:

You will get a migration file like so:

You’ll need to modify it accordingly:

Then run:

And you should be good. Just remember if you are using UUIDs you might want to make sure all models you generate use UUIDs.

In config/application.rb:

And make sure your generated migrations have:

Enjoy!

Preparing a Server for Atlassian Software

Standard

I’ve been a user of Jira before the kanban “agile” interface and it was still one suite with an agile plugin. I use both Jira Core (“task”) and Jira Software (“agile”). I use Core for task based projects and Software for well software based projects.

I actually use Core for home projects like: my daughters 3rd birthday, remodeling the garage, gardening task like cloning my chili plant or gardenias. I have a project with multiple task and sub-task.

Given: I have an over powered media server running Ubuntu 18.04 and I have a need to track my personal task and projects. And I thought it would be a fun weekend project.

When: I install Atlassian’s Jira Software Server, Jira Core Server, and Confluence Server (I will be also installing Bamboo Server and BitBucket Server at a later time)

Then: I will have access to Jira for any task or project and I can track progress. I will have also learned how to manage and use Jira from another point of view. Not just moving features across and completing them.

Continue reading

New Rails Project On Clean System

Standard

Creating a new Rails project on a clean system.

Install iTerm2. *My terminal of choice.

Install Xcode and command line tools.

Install Homebrew.

Install OhMyZSH. *My preferred shell.

Install rvm or rbenv or docker.

I prefer to use rvm on my development system and/or docker, I moved over from vagrant and vmware fusion. I prefer rvm on my dev system over rbenv. But I prefer rbenv over rvm on production servers if i’m not using docker.

Using MyNewProject as the project name.

1. Create the working directory.

2. Create the Rails app.

3. Done

Use your favorite text editor. Mine is Sublime and Vi.

Development Environment with Rails

Standard

Currently, I favor development with Docker because of the ease of deployment. I see the benefits when in a team environment using Docker, onboarding is much easier. Similar to using virtual machines you have images with your development environment all set up but with docker (containers) the footprints are somewhat smaller. I say that because the standard ruby base image isn’t exactly a lightweight it’s still around 700MB+ in size. But you could use Alpine Linux base images for the surrounding services ie database, Redis, elastic search.

I have experienced a few development environments so I’ll go through and list my point of view. Note: nothing here is the absolute best or de facto, just what I’ve used in real-world development teams. 

Continue reading

Programming languages/platforms and their package managers

Standard

This isn’t a complete list nor is it a best of list. This is just a list of what i’ve found and use.

Language / PlatformLibrary / Package Manager
Alpine Linuxapk
Cclib
CentOSapt-get
Common LispQuicklisp
Erlang / Elixirhex.pm
JavaScriptYARN
Mac OSXHomebrew / Ports
Node.jsnpm
PerlPPM / CPAN
PHPComposer
PythonPip / Eggs
RubyRubyGems
Ubuntuapt / yum

Batch clean up of local git branches

Standard

I usually add an alias in my .zshrc file so that I can run a single command to clean up feature branches that are merged into master or develop.

But if you run:

This will remove all branches that are merged into master or develop.

How to speed up bundle install on a Mac

Standard

Most new laptops/computers come with multiple cores standard.

So assuming you do have a system with multiple cores why not use them.

* This might work on any *nix system just find the appropriate commands.

Creating a new rails app

Standard

How to create a new project withouttest unit and with postgresql database