File Uploading with Ruby

Here’s how to get a file from the user to rails. Note: ruby’s CGI.rb accepts the multipart/form and saves the file to your /tmp directory. Rather than load and save the file again, we’re just going to copy it from /tmp. simple? not necessarily. Sometimes the permissions don’t get set properly during uploading. Don’t know […]

Who’s Online

So, how do you tell who’s online? If you’ve been subjected to the abomination that is myspace you’ll have seen that ‘online now!’ indicator. Well, here’s how I solved that one recently. First up, here’s a list of all the commands you’ll want. rake create_sessions_table script/generate model online script/generate migration add_user_id_to_session_table move to db-sessions rake […]

More Cracked-Out Scaffolding: element.twisty

For anyone following this, I’m slowly building you up to a fully-featured sortable, filtered scaffold helper library. You may recall we already built filtering with SELECT dropdowns. I’m going to add an input box and some sorting to that. First, though, we need a little sumthin sumthin to simplify the UI: the twisty! The twisty […]

Scaffolding on Crack

Do you have a massive list of items in a scaffold-type arrangement (e.g. in a typo-style admin)? Here’s a way to quickly and easily filter and sort your big-assed list. Note: this requires the Hash#to_sql function posted here a few weeks ago .. told you it was useful! More after the jump.. First, we’re going […]

The Best Music To Code To

I don’t know about you, but the music I rock out to while I’m programming has a big impact on how I work. If I’m listening to heavy, hard rock stuff, I find myself banging the keys on my (already battered) keyboard way too hard, feeling unstoppable but actually making a lot more mistakes than […]

Health Tips For Programmers

Let’s face it. Ever since you started coding, your body has taken an unmistakable turn for the worse. Your skin has lightened to the point of being reflective, your diet now consists of crisps and cookies, and let’s not even talk about the disaster zone that is your posture. Actually, let’s. Your spine. You are […]

What Is HABTM?

Real talk. HABTM means HasAndBelongsToMany, but it’s one of those confusing acronyms that doesn’t really match what it stands for. See, when you Wiki it, the page that comes up is Many-To-Many. Which is fine, it makes sense, but it’s not matching. I kinda like when things match, ya know? When you’ve been programming a […]