"Ruby on Rails" Posts

Production Server Sysadmin Essentials from the Scout Team

Posted in Scout, Ruby on Rails Comments Comments

Cbq
CBQ
02
Feb

Deploying Rails applications has definitely become easier with the use of tools like Capistrano and Phusion Passenger (a.k.a. mod_rails/mod_rack), but really keeping them serviceable, maintainable, and always humming along can require a bit of work.

Andre over at Scout has written a fantastic guide—a checklist, really for putting a Rails or Sinatra application in production and keeping it up in tip-top shape.

Read the Production Server Sysadmin Essentials or, as Andre likes to call it: “Sysadmin Eye for the Dev Guy”.

Rails Marketecture Diagram

Posted in Ruby on Rails Comments Comments

Cbq
CBQ
21
Apr

I’ve updated my course material for the class I’m teaching at the Big Nerd Ranch next week. We’re teaching Ruby and Ruby on Rails in a 7-day, intensive course for those new to programming and those who want an in-depth exposure to Ruby before diving into Rails.

I wanted to share this diagram I made for the new Rails 2.3.2 architecture—a mix between Marketing material and Architecture diagram that I’m calling a “Marketecture” diagram:

In addition to talking about Rails’ semi-new focus on RESTful controllers, there’s even a section on Test-Driven Development with Rails with the new TestCase libraries.

Renegade Cybergeeks at the nytimes.com

Posted in Ruby on Rails, Business Comments Comments

Cbq
CBQ
15
Feb

I’ve been in the New York Times newsroom at 5 pm on a Friday, when a reporter dropped in with brand new test score results from across the New York public school system—suddenly, it was like a machine springing to action. There were graphic designers loading SQL dumps of data, collaborating with developers and reporters, all working with the numbers to culminate and disseminate the information, and create factual reporting. It was truly amazing – even better than the afternoon I spent in the pits at a NASCAR race.

I bring this up not simply because of this fantastic article on nytimes.com about these Renegade Cybergeeks at the Times, but because I have seen what kind of great things happen when you put smart, motivated people together, towards great causes.

Last week, we got the chance to work with these developer/journalists (or perhaps journalist/developers) once again—and I couldn’t help but be simply thrilled to help, in a small way, by providing hands-on consulting and training to their Interactive and Computer Aided Reporting Teams.

We’re delighted to associate with these geeks.

James to headline MountainWest Ruby Conference 2009

Posted in Speaking, Community, Presentations, Ruby on Rails Comments Comments

Cbq
CBQ
16
Jan

Many critics are hailing Little Big Planet as the video game of the year. Its “flexible, fun, and powerful” level creator and sharing system has created an interactive platform never before seen in gaming.

But you don’t need to tell our James Edward Gray II about it – in March, at the MountainWest Ruby Conference” in Salt Lake City, he’ll be giving a featured speech on how Ruby programmers can learn from Little Big Planet’s creative problem solving and code reading. He’ll also be discussing some of the most creative Ruby projects out there, showing how their developers build servers, optimize code, and more.

A Playstation 3 and advanced knowledge of Super Mario Brothers Level 1-1 is optional but encouraged for attendees of this talk.

Rack at the Atlanta Ruby Meetup

Posted in Ruby on Rails, Atlanta, Speaking Comments Comments

Cbq
CBQ
12
Jan

Come see Matt talk about the Rack project, a minimal interface between webservers supporting Ruby and Ruby frameworks that’s behind the new Rails Metal functionality.

He’ll be going over Rack, and showing an example of a quick and dirty framework. He may even show how we use Rack handler’s to help handle Scout’s load.

Other topics include:
  • Weather Stuff from a developer at the Weather Channel
  • Rails Metal!

Check out the Atlanta Ruby Meetup Group and the January Meeting Event Details for more information.

Getting Started with Testing: Unit Testing or BDD with Rspec

Posted in Keeping it Simple, Ruby on Rails Comments Comments

Cbq
CBQ
31
Mar

If you’re just getting started with testing (and general test-first or test-driven development) in your Ruby and Ruby on Rails applications, you have a couple of choices.

You can go with Ruby’s Unit::Test, built right in to Ruby, and built-in to Rails with unit, functional, and integration test suites setup for you.

Or, you could setup Rspec with Mocha, and implement a form of testing called Behavior Driven Development or BDD.

Both approaches serve the same goal: better, tested code, easier code to maintain, and in general, just better practices.

My advice is to start with unit tests, and then move to Rspec later.

Read more... More

Lessons from the Trenches at Acts As Conference

Posted in Ruby on Rails, Speaking Comments Comments

Cbq
CBQ
11
Feb

For those who missed my talk at the most excellent Acts As Conference put on by the good folks at Rails For All in Orlando, Florida—here’s the cheat sheet.

My talk was on the lessons learned from teaching the Ruby on Rails Bootcamp and various on-site Trainings over the past year and a half. Here are the 4 key things you need to do to be a successful trainer:

Define Your Purpose – Come up with a clear, specific, desired outcome. Are you attempting to teach the basics, or promote mastery? A quick how-to, or a detailed guide to a particular way of development? A clear purpose helps your audience hit the ground running. An unorganized braindump can leave your students frustrated when they go at it alone.

Know Your Audience – You’ve got to understand everything you can about your audience. This means not only their current level of knowledge, but their past experiences, and even their goals. Ask questions before and during your training to understand everything you can about them. This will help immensely with the next tip.

Give Relevant Examples – Cater your examples to the domain that your audience knows. If you are teaching a bunch of journalists, use concepts from the publishing world. Never use foo, bar, or any other made up word in any example. If you don’t know, guess, and if your audience corrects you on the concept, you now have attentive listeners, contributing to your solution!

Teach How to Learn – Show, don’t tell. Stress how to find out why something works the way it does. Give plenty of examples, and help your audience figure out concepts. Give them the resources to continue learning and to find out more. Show them how you figured it out, or where you went to learn.

I’m sure there are plenty more tips, but I’ve found these 4 to be extremely valuable to me in coming up with valuable lessons and ways of teaching. Thanks to everyone who came up to me afterward to ask questions and share feedback about teaching!

Auto-Login for Any URL in Rails

Posted in HowTo, Ruby on Rails Comments Comments

James
James
06
Feb

One of our current projects at Highgroove sends a lot of email to its users. It essentially walks them through a process and emails them at each step. All of those messages include URL's to visit the relevant page in the application for that step. Since we've emailed them the URL's we don't want them to have to login every time they click one.

To get around that I modified the application to accept URL's like the following:

http://domain.com/login/TOKEN/ANY/SITE/URL

These URL's log the user in using their security TOKEN and then redirect them to /ANY/SITE/URL. This setup allows me to easily forward a user to any URL on the site which is great when writing all of these emails.

The code is easy enough too. I imagine many of us have a sessions controller that looks something like:

class SessionController < ApplicationController
  def create
    if user = User.authenticate(params[:email], params[:pass])
      # log user in...
    else
      # login error message...
    end
  end

  # ...
end

First, I just added some support for the token based login with redirect to that:

class SessionController < ApplicationController
  def create
    if params[:token] and (user = User.find_by_token(params[:token]))
      # log user in...
      if params[:path].is_a? Array
        redirect_to "/#{params[:path].join('/')}"
      else
        redirect_to home_path  # or whatever default page you want
      end
    elsif user = User.authenticate(params[:email], params[:pass])
      # log user in...
    else
      # login error message...
    end
  end

  # ...
end

The magic redirect_to() call in that new code uses a not-often-seen feature of Rails's routing. You can specify that Rails collect any number of trailing URL bits into an Array much like Ruby can do for method parameters. Here's the route definition I am using to get users to the code above:

# a custom login route with forwarding
map.connect "login/:token/*path", :controller => "session",
                                  :action     => "create"

The *path is the magic slurping parameter syntax, again just like arguments to a Ruby method. Rails will collect each piece of the remaining URL into an Array called path, so just remember that you need to rejoin the elements to make them a real URL again.

The Rails Way by Obie Fernandez

Posted in Community, Ruby on Rails Comments Comments

Cbq
CBQ
11
Jan

Recently I’ve been reading Obie Fernandez’s book, The Rails Way. I made an appearance in one of the chapters, but the real credit goes to Obie for pulling together an exhaustive 850-page book.

It’s not for beginners, but if you’ve taken one of my Rails training classes, it’s a great reference book and next step.

Reviews of the Rails Way:

Highgroove Studios at acts_as_conference Feb 8-9

Posted in Community, Ruby on Rails, Speaking Comments Comments

Cbq
CBQ
17
Nov

Just a quick note that I’ll be speaking on Lessons from the Trenches – Learning from the Rails Bootcamp at the regional Ruby on Rails Conference dubbed acts_as_conference (a play on the Rails way of introducing behavior through code) in Orlando, Florida, on Feb 8-9.

If you’re interested in how to effectively teach your friends, colleagues, bosses, and maybe even your mom about Ruby on Rails, registration is now open to the public. Looks to be a great conference line-up, with keynoters Obie Fernandez and Dan Benjamin, and plenty of great talks.

Older posts: 1 2 3