Total 44 Posts

Ruby: Pathmap

The Ruby library Rake has an awesome tool called Filelist that is great for manipulating files. For example, suppose you had an array of files with different path names, using the pathmap method, you can do some elegant file path parsing without the need for regular expressions. require 'rake' list

Ruby on Rails: List Objects Using Rails Console

I was looking for a way to get a collection of every model using Rails console. Here are a few simple ways to do it. Step 1 Run Rails Console. rails c Step 2 Raw list of tables ActiveRecord::Base.connection.tables Clean list of names ApplicationRecord.descendants.collect { |type|

Using Jenkins to Trigger Rake Tasks

This tutorial will show you how to install Jenkins on Linux Debian using VirtualBox and Vagrant. After you've installed Jenkins server, make sure you have both ruby and rake installed by typing: Step 0 - Install Ruby and Rake which ruby which rake Step 1 - Install Rake plugin Once

Ruby on Rails: Running a scheduler

Heroku offer's a pretty nifty scheduler add-on for running jobs on your app at scheduled time intervals, much like cron in a traditional server environment. If you ever need to create something similar in a non-Heroku environment, here's how using whenever. Step 1 First create a simple Ruby on Rails

Rails: Order by DESC

I wanted to present three different ways to get data from a Model and arrange it in descending order. Below are a few examples of how to get data from a Keyword model. Method #1 - Using a Controller Path: app/controllers/keywords_controller.rb At the controller level, you

Ruby: Converting XML to JSON

Today I was asked to convert an XML file full of e-mail addresses into JSON. The first file is titled email_builder.rb. The second script is titled email_parser.rb. Source Code

Rails: Database Relationships

When dealing with relational databases –such as Postgresql, MySQL or AWS RDS– it helps to understand how tables interact with one another. This cheatsheet is is designed to remind me how to connect the dots between different tables using Rails command-line generators. For the past few years, I've been working

Heroku: Managing Multiple Accounts

I feel like this is the first thing Heroku should tell you about after installing Toolbelt. For the longest time, I thought the only way to switch between different accounts was by logging out and logging back in. Here's how you can work with multiple Heroku accounts without having to

Heroku: Upgrading your database

Here's a process I've found for upgrading your database on Heroku. There are many more commands and I highly suggest reviewing the Heroku Documentation. First, check the status of your databse. heroku pg:info Set your app to maintenance mode. heroku maintenance:on Create a backup of your current database.
You've successfully subscribed to Chris Mendez
Great! Next, complete checkout for full access to Chris Mendez
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.