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
Total 44 Posts
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|
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
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
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
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
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
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
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.