So I wrote this website for my dad over the weekend. Mostly to replace this site I wrote about 8-9 years ago when I first learned HTML. Dad’s a sculptor and I thought it would be cool for him to have a web presence. Of course to update the site he has to edit these html templates I gave him, create thumbnails and non-huge regular images of the pictures he’s taken, and then ftp the files to his server. Not so fun for a guy born during the year of Pearl Harbor. So I wanted to create a site where he could easily create piece objects (with all the info), put them in galleries, and re-arrange the front page all through a web interface. Now a little over a year ago I did a similar thing for a friend of mine who sells homemade jewelry as my first Rails project and it took a while. Part of that was learning Ruby and Rails all at once, the other part was that I added some cool search functionality that she totally didn’t need, but mostly it was figuring out how to upload and manage images. That was a pain.
Now, armed with acts_as_attachment and a whole bunch more RoR experience, I knocked it out in a weekend. But the weirdest thing was that I didn’t write much code. Using the scaffold_resource generator I quickly threw up some pages to manage my 3 objects (FrontPage, Piece, and Gallery). Then I added some lines to Piece’s model to configure the attachments associated with it. I had to add a few more lines to make Piece’s views and controller deal with the attachments. And the rest of the time I’ve been screwing around with CSS trying to make it look nice.
The new site can not only upload images, but it automatically re-sizes them and creates thumbnails. Pretty bad-ass for a weekend. ‘Course I still have to deploy it.