Ruby

Total 44 Posts

Heroku: Dynamically capture your Dyno URL

Today I needed my Rails app to look at it's own production URL and capture the HOST information. After spending an hour looking for an answer, I found this very elegant answer. heroku config:set HEROKU_URL=$(heroku info -s | grep web_url | cut -d= -f2) Source Now from within

Rails: Populating Your Database using Seeds.rb

When I'm building a new app, I prefer to populate my site with fake data so that I can see how the app actually starts responding to queries. There are a few examples of how I populate my rails app with development data. LOREM IPSUM The Easy Way Step 1

Ruby: Loops

There are a lot of different ways to complete a loop. Here's a list of the most popular ones. Loop Loop in increments of 2 until x reaches 20. x = 0 loop do x += 2 break if x >= 20 puts x end Loop through in increments of 2 until

Heroku: How to Publish an Existing Rails App

With Rails 5, the deployment process to Heroku has gotten even easier. Here are the steps to publishing a new Heroku app without using a one-click install. STEP 1 - Create Rails App Make sure you have a Rails 5 app that uses a postgresql database. rails _5.0.0_

Rails: Grab a Tweet and save it to JSON or YAML

I'm currently working on a sentiment analysis problem that requires me to collect big data from Twitter and process it for later. As a first step, I thought it would be helpful to simply grab a single Tweet and study its structure. Here is a very simple way to get

Tools for App Makers

In order to build websites, apps or API's, every developer ultimately ends up curating a suite of tools that can help them build products better, cheaper and faster. Below are a few tools that I use all the time. API Development Postman - Google Chrome plug-in that helps you craft

Rails: link_to cheatsheet

Rails really pushes you to remember a lot of stuff. For example, something as simple as link_to can be really hard to keep track of because there are nearly a dozen ways to modify it. Here are a few different ways to use link_to within a view. Note:

Rails: Managing Migrations

Migration is a tool for managing databases within Ruby on Rails. The tool itself only offers a few features but people use it in a variety of different ways including: Creating new tables. Adding columns to an existing table. Dropping a specific table. Adding data to a table. Changing the

Ruby Enumberable

I doubt many people will need this but here are a few neat things you can do with Ruby. I won't go into great detail but it's methods like these that have me still loving ruby for its elegance. Anything in your collection will satisfy a given condition [1,2,
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.