May 23rd, 2007
@yourStringOfData.gsub(/\s+/, ’-’)
so simple. what did i use this for?
well i am using acts as sluggable in one of my applications and wanted to give the user a link to a post/note that they wrote so they can send it to their friends/family/etc…well basically since acts as sluggable uses your url + if + title, all i needed to do was get the title of whatever, and replace all spaces in the title with the line dash. hopefully this tidbit helps someone.
hmm, maybe i should create a top 10 tricks all new ror programmers should know.
April 19th, 2007
so i finally got around to setting up textmate to edit files on my hostingrails account. to my surprise it didnt require me to think to hard. basically you need to download 2 things, they are macFUSE and sshfs utility. they can be downloaded at http://code.google.com/p/macfuse/downloads/list. basically from my understanding, these programs enable you to mount your remote server account. kind of like having access to another computers shared folder on your windows desktop. i guess the macfuse enables the folder sharing, and the sshfs enables the secure connection?
well after you get the two installed, all you need to do is start the sshfs program and connect to your account. after filling out the username/password/ip address, your account folder will get placed on your desktop and wala, you can now treat this folder as a local folder and use textmate to start developing.
March 2nd, 2007
you can just do this in your view. for more information, check out the time class in the ruby api. basically if you would like to save time about a certain model/object, you can define ”:created_at, :timestamp, :null => false” in your migration file. doing this, you can print out various time formats like below.

<= yourvariable.created_at.strftime(“%b”)>
<= yourvariable.created_at.strftime(“%d”)>
<= yourvariable.created_at.strftime(“%a”)>
March 2nd, 2007
if you have a form and need a select list of numbers, here is a slice of code i use…
<%= select_tag :expnum, options_for_select((7..90).collect {|x| [x, x] }, :expnum) %>
So now you can access expnum in your controller view params[:expnum]