Its been a while since my last post! Been so busy working on ruby, at work, at home and play. Some of the interesting things I've been doing recently:
Conductors - I've been fascinated by the Presenter Design Pattern posted by Jay Fields and more here and read up everything I could, still it wasn't quite what I wanted. Then I found the blog entry by New Bamboo Conductors and Presenters. Basically a conductor goes between model and controller whereas a presenter goes between a view and model. A conductor is what I've been wanting -- a way to group to associated models such as customer and an order and work with it as one. I can call save on it,I can pass it to a form builder (which is sort of present-y but I don't care) Anyways, I am working on a blog post about it.
Exporting data to fixtures - for one project, I wanted to extract a subset of data to fixtures so I can load into a staging site for testing. Say I wanted to take the most recent 100 orders, which also grabs the associated record from customers, addresses, invoices, customer categories and products table. With the help of one of the recipes in the Rails Recipes (Pragmatic Programmers) I was able to write a rake task to export the data. The example exported all data from every table except schema_info. I rewrote it with explicitly naming the tables and the queries needed. I'll write up something on this too, including how I got around my yaml array being TOO large(I think thats the prob anyways) to import! doh!
Admin interface - I used the restful_authentication plugin. That's great for a sign up and login page but I also wanted a way to administer users. I debated on whether to make an controllers/admin/users_controller and banish anyone trying to access that controller and not an admin ... or, I can add the CRUD methods to the controllers/users_controller and check for admin at the start of the CRUD actions that only admin can use. I turned to the wisdom of the DevChix mailing list (sorry boys) and got some good ideas from the Chix. I need to write this up as well!
Facebook App - Not Rails, but could be. I was recently contacted by someone to make a facebook app. I've never made one, so that night I set out with PHP to write a little app. Within a few hours, I had a simple app. I let the company know that I figured out how to do it, and what was the next steps in getting the contract? *poof* they never emailed me back. I think they figured -- well if SHE can do it two hours, we can probably figure it out ourselves! haha... but it was fun anyways.
Rspec and Mocks - It took me awhile to get the hang of mocks... but determined I figured it out. Nice.
Right now I am just using the mocks in rspec, but want to look at other mocking frameworks to see what the difference is.
Autotest and snarl/growl - I now use autotest all the time on all my projects. I saw on PeepCode that Geoffery used growl to make a small window pop up on his mac with the status of the last run test. I showed my husband and said SEE? I need a mac. I thought there must be a windoze thing that does the same thing, I searched and found this post on SourceCraft Blog where the author talks about setting up autotest with Snarl (for windoze). I tried my darnest to get it to work on windoze and popup a snarl message (like you cool mac kids with your growl notifications) .. and there's a bug somewhere because it says every time 100% tests pass..and I know I'm not that good. Haven't worked on it in awhile though, so I should try again I guess (or get a mac, which I am trying to do!)
rcov - one project I was working on went pretty fast (one danger of doing Rails for people that are used to "other" languages) and I was accused of not making quality code! so I installed rcov and showed them my 100% test coverage. I know rcov doesn't tell you how "good" your code is, but it does tell you its well tested. How about them apples? ok, I'm a smartass sometimes.
The Rails Way - I was one of the technical reviewers for "The Rails Way" written by Obie Fernandez. It was a fascinating read and I learned a ton. I can't wait for the paper book to be printed, due out in October (The site says November, so maybe I am mistaken on October). If you do Rails -- get the book! I'll post a more detailed review when the book is out.
PeepCode.com - I've been an avid PeepCode.com fan from the first screencast I purchased -- about REST. I watched the episodes on TDD and the two about RSpec. This was very helpful. See, one problem I find with learning rails stuff is that there are all sorts of blogs on something, and sure by picking up pieces here and there you COULD probably get the learning you would gain from PeepCode.. but with PeepCode, its all in one spot and you can SEE it works, which is key for me. There is alot to be said for "seeing" something work to solidify the process in your mind -- but everyone learns different so that probably doesn't work for everyone.
Watching the rails commits - Ok so maybe I need a life. I've been watching the rails commits every day and seeing what changed. Alot of clean up going on it looks like. One of these days (soon I hope), I'll test some of the patches or try to fix a bug.
Lots of stuff going on and I'm having fun.