Tag: ruby

Google Hangouts for Remote Worker Telepresence

by Leon Miller-Out

Now that we've got a few full-time remote workers, we're really interested in making sure that they feel like part of the team. Telepresence really helps with that, and one great, free telepresence tool is Google+ Hangouts. We...

Read more

Using the Methods You Love in a Language That Is Lacking

Because I switch between ColdFusion and Ruby on a weekly basis, when I work on ColdFusion I sometimes miss some of the features that I have in Ruby. Like having a hash return a nil when a key doesn't exist, rather than getting an error when a key...

Read more

ruby relative_require

by Jared Beck
2012-10-21

Here's a nice ruby 1.9 discovery to brighten your day.

In 1.8 we had to:

require File.expand_path('../relative/path', __FILE__)

but in 1.9 you can:

relative_require 'relative/path'...

Read more

CloudFront CDN with Rails on Heroku

(or, Everything You Never Wanted To Know About Serving Webfonts From A CDN)

by Leon Miller-Out

TL;DR

If you're using a CDN to serve your static assets, your webfonts may break if you don't provide the correct CORS headers.

Update: be sure to turn...

Read more

Disable rspec verbosity to hide spec list

by Jared Beck
2012-07-19

Out of the box, rspec likes to dump all of the specs to stdout:

$ rake spec
ruby -S rspec ./spec/controllers/activity_categories_controller_spec.rb ./spec/controllers/attendee_controller_activities_spec.rb...

Read more

New to Rails? Tracking Down Free-Floating Methods

By Jeffrey Konowitch

I was quite confused when I saw lines like this in controllers that I was working on:

class SessionController < ApplicationController
  def create
    user = User.find_by_email(params[:session][:email])
    password = params[:session][:password]
    if user && user.authenticate(password)
      sign_in user
      redirect_to user
    else
      redirect_to sign_in_path
    end
  end
end

Sign in user? Is it that easy? Do I just type what I want in plain text and the computer will know what I’m talking about? Well, no, of course not...but as someone new to the system, these sorts of conventions can be really confusing.

If you find yourself in this position, then you are probably coming from another language where class inheritance worked differently from Ruby. 

Read more