Tag: ruby

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

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

Another Example of why Bundler is so Great

I had the occasion to integrate a custom signup form into a Constant Contact account via their API today. Since my little app was using Ruby (via Sinatra) that means that someone had already done the hard work of writing a library to access...

Read more

Rails Bugmash Wrap Up

Singlebrook had a great Bugmash on Saturday. Six developers from Ithaca's small (but committed) Ruby community showed up to help move Rails 3.0 to a release candidate.
Everyone here was a first-time contributor, so we had a range of successes, from...

Read more

64-bit MySQL, 32-bit Ruby

Happy New Year, everyone!

As is far too often the case these days, we ran into a problem while trying to make 32-bit software play nicely with 64-bit software. One of our OS X 10.5 workstations had 64-bit MySQL installed as well as fink's 32-bit...

Read more