Skip to content

I Think They Have Me Confused With Someone

Using HTTP Authentication with the Restful Auth Plugin

To keep on top of the odd bug in our code for the Web 2.0 Show, we are using the exception logger plugin. Josh and I wanted to subscribe to the RSS feed but we also wanted it to be secure, so that means HTTP Auth which most news readers support. DHH”s RailsConf Europe keynote was extremely timely in that he mentions using HTTP Auth from inside Rails using only a few lines. Here is a great summary of the keynote where I gleaned and adapted the following code. Just add this to any controller you would like to secure with HTTP Auth using your existing Restful Authentication plugin.

  before_filter :http_login_required 

  def http_login_required
  	authenticate_or_request_with_http_basic('Exception Admin') do |username, password|
  	  self.current_user = User.authenticate(username, password)
  	  logged_in?
  	end
  end

Useful Todo Lists in Textmate

 I really like the Todo list feature in Textmate, but as soon as you add a few plugins and freeze to edge rails, your todo list gets lost in the noise. After hunting through the code in the Todo bundle, I found the following environment variable being used: ENV['TM_TODO_IGNORE'] So I opened up the Textmate preferences pane, Advanced section, Shell Variables tab, and popped in a new var, TM_TODO_IGNORE, with the value of vendor. And for those that love the terminal, the “rake notes” feature in edge rails appears to skip the vendor folder by default.