Ruby on Rails LiveCD Author Looks for Suggestions

The author of the upcoming LiveCD that is poised to make installing Ruby on Rails for Linux users easier then ever is taking suggistions for what else to pack onto his CD before launch.

You can check out the RailsLiveCD site to find out when it will go live! It currently has the following on it already:

jEdit, RadRails, Subversion, MySQL, PostgreSql, SQLite and a lot of the useful gems already installed.

You can contact Brian Ketelson the creator with your suggestions through the ruby-forum.com.

Ruby on Rails Cheat Sheet Collectors Edition

This Ruby on Rails cheat sheet is a reference guide for RubyOnRailsBlog.com that will be continuosly updated and improved as new features are added to rails and new cheat sheet tips are added to the guide. It is a collection from the one of the very best guides, apis and source snippets that are concise that i’ve found. I’ve fixed errors and added highlighting to it and it is a mirror of the one found on nanorails site plus my own changes. New updates will be posted to this post under Recent Updates.

Common Error With Flash Notices

I recently was asked to look at an app where none of the css flash generated errors were being displayed. Low and behold the culprit was something very simple in the syntax involving ruby symbols.

Their Problem

flash['notice'] = "Section Created Successfully"

My Solution

flash[:notice] = 'Section was successfully created.'

Rails Expiration of Sessions due to Inactivity

In some apps (some may argue most) session management is a critical aspect for performance and control of the system. From a sysadmin point of view it doesnt make a lot of sense to let a session stay connected forever since it will hog resources that could be put elsewhere.

So here is a way to expire sessions that become inactive in rails:

Employees HABTM projects, projects HABTM employees

The Problem

I am doing a permissions page for a project where I know that I can get all of the employees in the system (@employee.find(:all)) or get all the employees for the selected project.

How can I get a list of all the employees in the system and have a check box that states if they are associated with the current project or not?

A solution

This is just one way of doing this and its very simple once you see it:

Create this and use this methed:

Setting the Relative Url Path in Ruby on Rails

The Problem

You're using apache with fastcgi and you can access the "you're running rails" page at the but can't get to any of my controllers at , getting 500 errors instead.


The Solution

In environment.rb set the following at the bottom:


ActionController::AbstractRequest.relativeurlroot = '/myrailsapp'

If that fails, I recommend trying it with mongrel webserver which has been known to fix whis problem for many.