The best day evar!! Merb + Rails!

Posted via email from Structurally Sound Treehouse

Posted at on 12/23/08 by | 0 comments | Filed under:

Seth Godin on Humility

Confidence is often a self-fulfilling prophecy, particularly in marketing or investing. Arrogance, on the other hand, is hard to reward. My favorite combination is the quiet confidence of knowledge, combined with the humility that comes from realizing that you're pretty luc

Posted via web from Structurally Sound Treehouse

Posted at on by | 0 comments | Filed under:

Things TextMate 2.0 needs

I feel a trend. It seems that a lot of developers are moving away from TextMate to (or back to) vim or emacs. Or, at the very least, if users are not moving, they are talking about it.
Don't believe me. See these links:
I have always had a fascination with really powerful vim/emacs users. The simplicity or the interface, and the awesomeness of mouse-less control is just too great. I am a decent vim user. I am ~6 on a scale to 10. But, on a day to day basis, I'm a TextMate user. But, I fear that TextMate will start loosing users.
So, here are some features that TextMate v.2.0 needs:
* Split screens. Just make it like vim. done and done.
* No more floating dialogue boxes for 'search'. Make it like Safari. A more unified UI, more like Leopard.
* Better ctags-esque support. I say "esque" because I realize with Ruby, it will be difficult. But, at the very least, give me a really easy "go back to where I was" key binding.
* Better editing key bindings
* Better undo. Basically, it needs to be smarter, like vim.

Posted via email from Structurally Sound Treehouse

Posted at on 12/22/08 by | 0 comments | Filed under:

Changing your shell to zsh on Leopard

I am gonna start using zsh as my default shell. Here is how you make it your default shell for Terminal.

Posted via email from Structurally Sound Treehouse

Posted at on 12/19/08 by | 0 comments | Filed under:

Git and Story Branches
Nice post describing how to use git and branches for stories. A good commentary near the end about why a centralized SCM solution is too constraining for this approach.

Posted via email from Structurally Sound Treehouse

Posted at on by | 0 comments | Filed under:

Font: DejaVu - My new favorite monospaced font.
Download link is in the middle of the page.
I am using it in TextMate, Vim and Terminal. So far, it is great.

Posted via email from Structurally Sound Treehouse

Posted at on 12/18/08 by | 0 comments | Filed under:

Book: Design Patterns in Ruby

Design Patterns in Ruby (Addison-Wesley Professional Ruby Series)
Go read this book. It will make you a better Rubyist.
Some high level lessons learned:
* Since Ruby is a dynamic language, the "traditional" patterns need to
be applied differently, or, in some cases, not at all.
* Understanding when to (or not to) apply patterns is what makes you an expert.
* Recognizing a pattern in the wild is just as important as knowing a pattern.

Posted via email from structurallysoundtreehouse's posterous

Posted at on 12/17/08 by | 0 comments | Filed under:

Wait. How can Apple not attend their own event? Oh . . .
Am I the only person who thought that Apple put on the Macworld event?
 And, what will happen to all the near-real-time-AJAXy updates of the
keynote? Isn't that why AJAX (Apple Jobs and XML) was created?

Posted via email from structurallysoundtreehouse's posterous

Posted at on 12/16/08 by | 0 comments | Filed under:

Awesome! Posterous works! Everyone sign up!

Done and done! Posterous is where I will start blogging and Twittering.
Everyone sign up for an account!
I think Posterous is Rails . . . even better. I support all the Rails
start ups.

Posted via email from structurallysoundtreehouse's posterous

Posted at on by | 0 comments | Filed under:

Test: Posting to Posterous, Twitter, and my blogspot blog from a single email to Posterous

If this works, this will be totally sweet!

Posted via email from structurallysoundtreehouse's posterous

Posted at on by | 0 comments | Filed under:

Mocking and Stubbing FTW! Wait, was it WTF instead?

This is why mocking and stubbing sucks:

This is why mocking and stubbing is awesome:

And, this is what the godfather says about this:

Who else is confused? I think the TDD/BDD community needs to start explaining themselves more regarding the principles of testing. We need a "pattern" for TDD/BDD testing for Ruby and Rails (Merb) projects.

I have had many conversations/debates regarding this very issue. And, every time I read one of these articles, I go from one side to the other.

So far, here are my conclusions regarding testing:

* TDD/BDD is hard.
* TDD/BDD is necessary.
* 100% coverage is unrealistic.
* Doing "red, green, refactor" all the time almost never happens in the real world.
* Someone needs to write an up-to-date and definitive book regarding this subject matter, and end the debate.

Posted at on 12/11/08 by | 0 comments | Filed under: , , ,

Ruby: Enumerable#inject links

Great Enumerable#inject tutorial and introduction:

Thinking out of the box with Enumerable#inject:

Posted at on by | 0 comments | Filed under: ,

Get Tables in PostgreSQL (Postgres)

This is how you get a list of tables in Postgres.

SELECT tablename FROM pg_tables
WHERE tablename NOT LIKE ‘pg\\_%’
AND tablename NOT LIKE ’sql\\_%’,
order by tablename;

Posted at on 12/9/08 by | 0 comments | Filed under: , ,

Project Patterns

This is a discussion my team had regarding some lessons learned during one of our recent projects.

Project Patterns
View SlideShare presentation or Upload your own. (tags: projects management)

Posted at on 10/24/08 by | 2 comments | Filed under: , ,

Fluid App for Google Reader looking like Newsfire

Do you want your Google Reader Fluid app looking like this?

Uploaded with plasq's Skitch!

And, not like this?

Uploaded with plasq's Skitch!

Then, read this:


Posted at on 10/23/08 by | 0 comments | Filed under: , , ,

Stuff in my office

My desk:

Re: IMG_0009
Uploaded with plasq's Skitch!

Story Board:

We are going to start really implementing some Agile and XP Programming practices.  It will probably end up being some crazy hybrid of pure XP and awesome Agile (and, no they are not the same).

Uploaded with plasq's Skitch!


Who else spends Friday nights at Barnes?  And, no I have not completely, 100% read through all of them.  But, yes, I have read through most of all of them.

As you can tell, I love me some Pragmatic books.

Re: my_books
Uploaded with plasq's Skitch!

Posted at on 9/26/08 by | 0 comments | Filed under: ,

Top 5 Rails Misconceptions

I have been working with Rails for almost 3 years now in a professional setting. During that time, I have had to convince many people of the merits of Rails. Here are the Top 5 Rails Misconceptions I have come across.

5. Rails is some sort of WYSIWYG editor for web pages.

This one has always baffled me. But, it is true. Every once in a while, I will meet someone that thinks Rails is like Dreamweaver. Huh? My best guess is that they read some buzz article about how "Rails makes building websites easy". Notice I said "websites". There really is no way to combat this misconception other than to just educate this person.

However, do not discount the fact that to many technology people the following is true.

web sites == web pages == GUI == web applications

In other words . . .

index.html == web page also == web page

And, it was probably developed with Dreamweaver.

4. Rails is AJAX.

Web 2.0 is AJAX. And, Rails is AJAX. So, make it AJAX'y. Maybe, this is because Rails started to get popular around the same time AJAX started getting popular. There might be some direct relationship between the two. But, regardless, I hear this one all the time.

Again, you really can't do anything about this except to try and educate. Usually, I try to explain that AJAX is a way to enhance the user's experience, and can be implemented with any number of web frameworks.

Hmmm . . . but, that explaination might be too "Web 2.0".

3. Rails can't scale.

You might be surprised to see that this is not #1. In all honesty, I almost never hear this argument from the people who matter to me (customers, clients and my bosses). I alway hear it from the IT/Ops team, or the DBA's, or the old school Perl/Java/C/C++/insert_whatever_lang_here programmer that sits down the hall.

How this is still an issue is beyond me. In any case, these are the arguments I usually use:

* There are really large Rails sites in production. Twitter (although be ready for the Twitter can't scale arguments),,, all the 37signals products.

* Scaling is usually a much larger architectural issue than just the web framework. Scaling involves hardware, OS's, caching, DB's, proxies, etc. Usually, the language matters very little in scaling.

* And, this is my favorite . . . every (I really mean EVERY) enterprise Java based web application I have ever worked on or implemented was slow as hell. Anyone want to back me on this one? So, what's the argument?

2. You don't need to learn Ruby to do Rails.

I think this early screencast of Rails almost did more harm than good.

So, in this screencast, you see a young DHH creating a blog application in 15 minutes with Rails. Lot's of scaffolding and stuff.

Don't get me wrong. This screencast was one of the reasons I got into Rails. But, I thought the same thing. I just need to learn Rails. This is so false. Maybe, if you are creating a 15 minute Blog application, you just need to learn Rails.

This misconception is directly related to my #1 Rails misconception.

1. Rails is not programming.

This is definitely my #1 Rails misconception. I hate this one! Everyday, I have to fight this one.

So, how do I fight these misconceptions?

* Credibility. Be really good at what you do. As a Rails developer, don't be that person who just read the "Agile" book and thinks they can deliver. Read the "Agile" book. Then, you have to do much more . . . usually, this is in your free time.

* Productivity. Deliver quality faster than anyone else. Rails is great for this.

* Adaptability. Sometimes, you just have to make it work. So what if your company's legacy database is SQL Server with some jacked up composite-non-surragate primary keys? Make it work.

* Be nice. This one works all the time. Ruby, and Rails is threat to people. Don't come on like a threat.

Posted at on 9/24/08 by | 0 comments | Filed under: , , ,

Story Card Template for Agile Programming

Here is a story card template that my team will be implementing into our Agile Programming practices.  Feel free to use.

BTW:  Scribd renders the page weird in their Flash viewer.  If you download it, it looks fine.

Posted at on 9/12/08 by | 0 comments | Filed under: , , ,

Subversion - Compiling from source

I will assume that you know how to perform the standard ‘nix compile steps. And, that you know where to put the compiled files.

Why compile from source? Why not use a package manager, such as Yum or MacPorts?
  • You are hard core old school.
  • Usually, it is because the package maintainers have not put out the latest (or a specific version) of a package that you need NOW!
Some gotchas with compiling SVN (who would have thought):
  • Prerequisite libraries. Since you are not using the awesomeness of a package manager, which will take care of prerequisites for you, you MUST have required libraries pre-installed. Those libraries can be installed from a package manager, or you could have compiled them from source. It does not matter as long as you know where they are.
  • Out of the box, SVN does not support the HTTP or HTTPS protocol. What?! Yeah, I know. This is the main gotcha. If you do not configure SVN for this, you will get the “URL unrecognized” error, which is what we were seeing yesterday.

Here are the steps:

Install the
APR libraries.

These usually come with the Apache installation. If you have Apache installed, and you still don’t have them. You probably need to install the Apache development files too.

The files you need are:
  • apr-config
  • apu-config
Look in:
  • /usr/bin . . . or
  • /usr/local/bin
For some reason on CentOS, with the Apache libraries installed with Yum, the files are called:
  • /usr/bin/apr-1-config
  • /usr/bin/apu-1-config
Install Neon with SSL support

You will need the OpenSSL libraries installed.
  • ./configure—with-ssl
  • make
  • make install
Install Subversion with HTTP and HTTPS support

  • ./configure --with-ssl --with-apr=/usr/bin/apr-1-config --with-apr-util=/usr/bin/apu-1-config --with-neon=/usr/local
  • make
  • make install
Note: Make sure that you have the correct paths for the --with-apr, --with-apu, and --with-neon parameters.

You can make sure that SVN installed correctly with the proper support for HTTP and HTTPS by running the “svn—version” command. You should see this.


Posted at on 9/11/08 by | 0 comments | Filed under:

iPhone Fix - This worked for me

I did the following to fix my third-party applications crashing problem.

  • Uninstall all my third-party applications via the iPhone
  • Delete all my third-party applications form iTunes. I think this is the key step.
  • Do a restore of the iPhone. I'm not sure if this is necessary. But, I did it.
  • Installed a third-party applications from iTunes, not via the iPhone. This worked! Yay!
  • Tried to install from the iPhone. This now works. Yay!

Posted at on 9/9/08 by | 0 comments | Filed under: ,

iPhone Rage

Over the weekend, my iPhone started crashing all my third-party applications. Try to load Twitterrific. Get the nice blue bird logo. Then crash! Strange. Let's try Remote. Same thing! Wordpress? Same. WTF?!!

So, I deleted all of my installed third-party applications. Re-installed them. Still crash! Crap!

This morning (Monday), I decide to give it one more try. Tried to re-install a third-party application. This time, it won't even install! Stupid!

So, before the comments start coming in. I have the savvy when it comes to tech. Probably more savvy than most of you combined. So, spare me the useless comments about how I don't know what I'm doing.

I am on the latest iPhone firmware 2.0.2. I tried a hard reboot. Now, as I write this, I am waiting on my restore to complete. We will see what happens.

It is ironic that I started having iPhone problems almost immediately after having a SUCs session with my team about the iPhone's design problems. It is almost like it knew I was talking bad about it.

Posted at on 9/8/08 by | 0 comments | Filed under: ,

SUCs - The iPhone

We had a Site Under Construction session for the iPhone.

Posted at on 8/29/08 by | 0 comments | Filed under:

Vim: About time we learned this

I gave Show & Tell today about Vim. Nothing too in depth. Just some basic commands. I wish I had mad Vim skillz.

Posted at on 8/19/08 by | 0 comments | Filed under:

"Site Under Construction" sessions (or SUC sessions for short)

During my quarterly reviews with each of my team members, I am discovering some commonalities in what people would like to learn.

A common goal seems to be “to get better at application design”.

Good design is a great goal. But, like anything worth accomplishing, it is difficult. Good design can be difficult to learn and teach. And, is more experiential than anything else.

One of the reasons is because “design” encompasses so many disciplines. Also, the most difficult thing about good design is that a lot of attributes of good design are in conflict with each other.

  • Copy vs. Graphics

  • User vs. Non-user

  • Usefulness vs. Stickiness

  • Art and Color vs. Transparency

  • Functionality vs. Simplicity

  • Consistency vs. Flexibility

How do you learn that? How do you teach that? You can read books. You can attend some classes. There are certainly “official” ways to master this.

Just think about it.

I think another way is to just be mindful of it. Think about it all the time. When you log onto Gmail every morning, think about why it is good or bad. When you use Finder, think about it. Why does the Dock work the way it does?

Just think. You don’t have to be correct. But, at least, you are analyzing. You don’t have to write it down. But, you should file it away in your cloud brain for use later.

So, to help accomplish this, my team is going to start doing "Site Under Construction” sessions. I like to call them "this (insert whatever here) SUCs". We will put up a website, applications, or device or whatever. And, we will just discuss it. The good and the bad. There is no correct answer.

Posted at on 8/14/08 by | 1 comments | Filed under: , ,

Customize Apple Terminal's Title Bar and Prompt

I like to show my username, computer name, and current path in my Terminal's prompt. But, it would also be nice to show it in the title bar.

Just add this line (or replace it if you already have one) in your ~/.bash_profile file.

export PS1='\u@\h:\w\$ \033]2;${USER}@$(hostname):${PWD}\007'

This will make your Terminal window look something like this:

Picture 1

If you want to be really hard core, you can customize your tabs too.

Use this: Show remote host names as tab titles in Terminal.

Basically, you create hard links to the ssh binary with the name of the remote host as the name of the hard link. And, since Terminal displays "ssh" in the tab, you can get Terminal to display the hard link's name instead. Makes sense to me. But, I don't need it.

Posted at on 8/12/08 by | 0 comments | Filed under:

Innovations in Ruby

Posted by the guys at for a talk they gave at Ruby Hoedown.

Some interesting things that I did not know about.

Posted at on by | 0 comments | Filed under: ,

What you need in order to become a Ruby on Rails developer

I often get asked and see forum/blog post asking this question (or some variation of it):

"What do I need in order to start Ruby on Rails development?"

The following may not apply to all. But, face it. Admit it. There can be only one way. So, just follow this simple step to more joy and bliss. Here is the step to take. Yes, there is only one step.

Grow some balls

You need . . . To leave your crappy job. To admit that the technology platform you committed the last 5 years to is crap. To be happy about what you do everyday. To realize that the boss you hate really deserves it and doesn't deserve to continually make money off your efforts. To wake up and smell the Ruby.

Also, you need to stop drinking with your worthless "buddies". And, start spending some time learning Ruby, and Rails.
"But, but, but . . . those are my budz, my free time, my weekends . . . wha, wha, whahaaa".
Forget that! Those bums aren't going to help make you great. If that is your concern, then just stop reading now.

So, tell me about your balls growthage

"But, that's easy for you to say. I am in (insert some worthless excuse here) . . . blah, blah, blabbity, blah, blah . . ."

So, before you start thinking that I am just blowing smoke, here is my testimony.

I started in Java development. Became an expert in the IBM WebSphere stuff (when I started with it, it was all MQ this, MQ that). Grew into "Systems Architect", "Project Manager" . . . (insert whatever title you want here). Discovered it was boring as heck keeping track of people's hours and arguing over requirements with a client. Start to learn Rails. And, here's the key part. Wait for it . . .

I LEFT my job to do Rails. I took a pay cut (about 12%). I left all that "expertise" that I built up behind. I did all this with a wife, a one year old daughter (at the time), and a mortgage, and school debt.

That's some Rambo-esque courage! But, you can do it too!

What's the technology that you left behind?

Java. No, wait. More specifically, J2EE enterprise software integration. That means taking some stupid vendor software, like (insert stupid enterprise vendor software here . . . I'm looking at you Documentum), and making it fit into the business no matter what.

What to read

Ok, after you have done Step 1, you can read ALL of the following. Then, send me a 2-page report.

I am too lazy to provide links. So, you just Google it. Also, this list is current as of this date. It is what I would recommend someone to read as they start with Rails. Some of them are coding books. But, others are not.

  • Getting Real

  • The Ten Faces or Innovation

  • Beyond Java

  • From Java to Ruby

  • Extreme Programming

  • Rails Way

  • Ruby Way

  • Web Standards Solutions

I left off the two "Bibles" of Ruby and Rails. I have those. Both are good. But, I do not regularly use them. So, they are left off the list.

There are only two blogs/podcasts to subscribe to that are worth the time:

  • RailsCasts

  • Rails Envy

It's not code, it's passion

Enough said. If you want to discuss, you know where to find me. Out!

Posted at on 8/11/08 by | 0 comments | Filed under: , ,

Why Apple was correct in pulling "I am Rich"

If you do not know what "I am Rich" is, just Google it.

There are a lot of people talking about how Apple was wrong to pull the application. I have seen a few, all stupid, arguments for not pulling the application, such as . . .

It's art. Huh?

Buyer beware. Whatevs!?

Dumb arguments.

Apple was correct in pulling it.

It is a stupid application. At a stupid price. And, it isn't even funny as a joke. It doesn't even do anything. Make it rotate or sparkle or anything! Apple should continue to pull these dumb-ass applications. In fact, Apple should pull all applications that are just plain bad.

Why? If Apple is going to act as the gatekeeper for iPhone applications (whether I like it or not), then Apple has an implied duty to remove these types of applications. This is key: Apple is the gatekeeper for ALL iPhone apps.

It is all about trust. I think of it as sort of how we all trust Google to return fair search results. Google works hard to remove crap links and sites that try to "game" the system. We trust them.

We need to trust Apple. A developer needs to know that Apple won't allow these dumb-ass applications through. It just dilutes the space, and ruins it for legit developers. A buyer needs to know that they are not going to get jacked.

Editorial: A few statements on what I think about the App Store.

I do not agree with Apple's decision to require all iPhone applications to be distributed via the App Store.

No trial period for applications sucks. How do you get a refund? Apple has unilateral power "approve" it or "reject" it? Huh? So, I have this awesome idea. I work on it for months, and Apple can just reject it? That's really encouraging me to start working on my iPhone application.

The worst part is that the App Store is full of junk. If Apple is going to act as gatekeeper, then they need to do a better job. Some of the apps are not even iPhone applications. A whole bunch of the applications are just SSB's, which you could do already.

If the iPhone applications does not leverage the SDK, then it is NOT an iPhone app.

An iPhone app, in order to be an iPhone application, must use the phone's hardware, or integrate with a native service or application. Otherwise, it is just crap and useless as an iPhone app. You wouldn't call Gmail in Safari a Leopard application?

So, either be The Gatekeeper or don't.

If Apple is going to be gatekeeper, then do a better job of it. Don't let these dumb apps through. Make sure the apps are legit iPhone applications. Trial periods. Refunds. All the stuff that makes any customer experience good.

Or, don't be the gatekeeper. Let the developers deal with it. That's how it is now with Mac applications. What's the diff?

Posted at on 8/8/08 by | 0 comments | Filed under: ,

TextMate: Speed up searching in a project (CMD+Shift+F)

I hate how slow TextMate is when searching in a project. Well, it turns out that it is not really because TextMate's search is slow. It might be. Most likely, the real problem is that, by default, TextMate is searching through ALL your Rails files. ALL, as in logs, vendor/rails, and so forth. This is what is slowing things down.

I don't take any credit for this. This is a tip from Dr. Nic on a TextMate Google Groups thread. But, I will distill it down for you.

Copy this crazy looking piece of regex (at least . . . I think it is regex):

!.*/(\.[^/]*|vendor/rails|doc|rails_root|CVS|log|data_dump|build|_darcs|pkg |_MTN|\{arch\}|blib|.*~\.nib|.*\.(framework|app|pbproj|pbxproj|xcode(proj)? |bundle))$

Fire up TextMate.

Open up Preferences. ("CMD + ," for the cool people.)

Go to Advanced -> Folder References

Picture 1

In the "Folder Pattern" field, delete what is there (you may want to save it somewhere . . . I just gmailed it to myself), and paste in the crazy regex from above.


Now, TextMate in project search will be much faster!

Posted at on 8/7/08 by | 0 comments | Filed under: ,

Install Memcached on CentOS 5.1

I can use Yum. But, I am going to install from source in order to get the latest builds.


Memcached requires libevent. So, get and install libevent first.

tar zxpfv libevent*
cd libevent*
sudo make install


Next, install memcached.

tar zxpfv memcached*
cd memcached*
make install

Errors . . . there is always at least one

You may get this error:

error while loading shared libraries: libevent-*: cannot open shared object file: No such file or directory

You need to create a symbolic link. For me, this is the command I needed to run. Yours may differ depending on the release you downloaded.

sudo ln -s /usr/local/lib/ /usr/lib

Start memcached

memcached -d -m 64 -p 11211

"-d" runs memcached in daemon mode.

"-m" is the amount of memory memcached will use in MB's.

"-p" is the port # for memcached.

Connect to it from Rails 2.1

Rails 2.1 is awesome because of its new caching features. It can support memcached as a cache server. In order to get this to work, add/edit the following line in your config/environment.rb file. Or, you can add/edit your specific environments file, such as config/environments.development.rb file.

config.cache_store = :mem_cache_store, 'IP_ADDRESS_OF_MEMCACHED_SERVER:11211'

Posted at on 8/6/08 by | 3 comments | Filed under: ,

Nobody Goes Full Retard

Check out the comment from vegetta00 about the 10th one down.

Posted at on 8/5/08 by | 0 comments | Filed under:

Even MORE Scrum-esque

Scrum is an "agile" process for software development. Part of the Scrum methodology is The Scrum Meeting.

My team uses Scrum, but we do it even more scrum-esque

At first, we held daily meetings at a consistent time. The purpose of these short meetings were to:

  • Inform the team of your status

  • Help you organize and prioritize your tasks

  • Overcome issues. An issue is not a bug or problem. An example of an issue would be something like, “My ssh access to the QA server stopped working.”

When Scrum meetings work, it is like a well-oiled machine. You should be able to determine the project's status just by listening to everyone else.

Scrum meetings eliminate the cruft, and focuses on the important issues.

But, for my team, we needed to be even MORE Scrum. Meeting everyday was too tiresome, and boring. And, we often discussed other interesting topics, such as "Why Iron Eagle is such an awesome movie."


So, we do our Scrum meetings like this:

  • No meetings.
  • Just email.

The emails look like this:

  • What you did yesterday
  • What you will accomplish today
  • Issues

The scrum email should answer the following:

  • Does it inform the team of your status?
  • Does it help you prioritize your tasks?
  • If you were doing the wrong thing, does it let others know that you are doing the wrong thing?

So far, it has been working out pretty well.

Posted at on by | 0 comments | Filed under:

Mac Keyboard Shortcut: Bringing an Application back from a Minimized State

One of my life goals is to completely remove the mouse from my daily interfacing with my Mac.

Ok. So, you all know how to minimize an application window.

Command + M

So, how do you bring it back? Command + Tab does not work. That just puts the focus on the minimized application.


Command + Tab . . . to switch to the application you want. Then, before you let go of the Command key, press the Alt key, then let go of the Command key while keeping the Alt key down.

It is a little weird, and takes a bit to get used to it. But, once you do, it'll be like second nature.


Posted at on by | 4 comments | Filed under:

Can an ActiveRecord object destroy itself?

Without getting into real detail, I need this behavior because of a legacy database (Actually, it is not all that "legacy". It is more "enterprise-esque".).

Anyway . . .

Question: Can an ActiveRecord object invoke an instance method, then, while executing that method, destroy itself?

Code example:


Class SomeObject < ActiveRecord::Base
def some_method
...Some really awesome stuff happens here...

At first, I thought it would work. There are plenty of times where I have invoked a destroy method on an AR object, then use that same AR object later. I do this in controller action methods often.

But, even as I was writing that logic, it did not feel correct. But, Ruby has a tendency to surprise me. So, I gave it a shot.

It turns out that you cannot do this. I am not sure if this is a Ruby or ActiveRecord behavior. If anyone knows, please comment.

To me, it seems like appropriate behavior.

You should not be able to start some set of tasks, one of which causes you to kill yourself, but requires you to finish off the rest of the tasks.

I accomplished the same behavior by creating another object within the instance method, and destroying that object.

Code Example:

Class SomeObject < ActiveRecord::Base
def some_method
...Some really awesome stuff happens here...

Has anyone else come up against this? Am I solving this problem correctly?

Posted at on 8/1/08 by | 5 comments | Filed under: ,

Gmail with Fluid and this Script

If you are on Leopard and don't use Fluid, then get a clue. And, start using the awesomeness.

I love me some Gmail. I keep trying Apple Mail. But, I always end up back at Gmail.

So, try this to make your Gmail on Fluid even better.

My Fluid Gmail app looks like this:

Picture 1

I like the dark background, font, and NO ads!

To do this, follow these easy steps.

1. Create Gmail Fluid app.

2. Launch the Gmail Fluid app, not the Fluid app creator app.

3. Go to "Browse" in the menu bar.

Picture 2

4. Search for "gmail dark blue"

Picture 3

5. Click on "Gmail 2 - Dark Blue Google Inspired"

Picture 4

6. Install the script by clicking black "Install this script" button at the top of the left column.

Picture 5

7. Relaunch the Gmail Fluid app! Awesome!

Posted at on 7/31/08 by | 0 comments | Filed under:

Show & Tell Sessions

We have implemented what I am calling "Show & Tell Sessions".

Here are a few guidelines:

  • Rotate through the team

  • Presentations should be about 30 mins long to allow for questions and discussion

  • You are not the expert giving a class. You are just some dude who wants to share something interesting.

  • Don’t preach unless it is accepted practice. For example, “preaching” about how inline CSS in HTML mark up is bad is ok with me. But, “preaching” about how Ruby is better than C is not. But, giving a demonstration of Ruby is ok.

  • Does not have to be about code or technical in nature.

  • It can be about anything that is somehow related to what we do. For example, a designer might give a presentation on typology.

  • We all have to attend (unless it is impossible). This is to show support and respect to your fellow man.

  • Teaching something is the best way to learn something. My hope is that these sessions will expand our knowledge.

    Posted at on 7/30/08 by | 0 comments | Filed under:


    A while back, I implemented "self-training" for my team. So far, I think it has been a success.

    This is a mandatory task for the team. “Mandatory” as in it counts towards your performance. “Task” as in you do it. “Team” as in the team.

    Here are the rules:

    • Must do at least .5 hour per day

    • Can not roll it over until you do it all in one day (i.e. 5 hours on Friday)

    • You can use as many hours as you want towards a particular subject

    • Any topic that is related to what we do is fair game

    • If you want to buy a book or something, let me know. I will get it expensed.

    • I can ask you to change it, expand it, or focus it if it seems like it does not accomplish number 5 or if you are spending too many hours on it.

    So, Why? What's the point?

    • To become more awesome

    • To save Vail time and money

    • To master your craft

    I am sure that we all do some of this on our own. However, I wanted to structure it so that we will be accountable to one another for it. In other words, you can’t say you are learning something and not do it because one of us may ask you about it.

    Some of the self-training subject matter will overlap with something you are assigned to do. For example, I don’t know much about implementing a central authentication systems. And, I want to implement it at Vail. I may self-train on it.

    If that is the case, I would suggest approaching the self-training hour from an objective point of view.

    “How does it work?” As opposed to, “How can I get it to work for Project xyz?”

    It is a subtle difference and may not matter in practice. But, I don’t want to be biased in what we are learning towards some project timeline, or limitation.

    In the end, it is all about being better. What we do is our craft. We should master it.

    Posted at on by | 1 comments | Filed under:

    The Presenter Pattern - ActivePresenter for Rails

    This is pretty sweet.

    Rails strictly adheres to the MVC model . . . which is good. Where Rails falls a little bit short is when a view needs to manipulate multiple models. The out of the box Rails behavior is one model to one controller to one view.

    But, in practice, you often have views that manipulate multiple models. Thankfully, because Rails is flexible, you can accomplish this in a number of ways. However, it often leads to inconsistent code structure, and fat controllers, or nearly untestable code.

    What we needed was a “pattern”. I had heard about the presenter pattern last year at RailsEdge in Chicago. At the time, it was just a concept. I didn’t really get it.

    Looking at this post (ActivePresenter), I get it now. And, its implementation is pure elegance. I can't wait to try it out.

    Posted at on by | 0 comments | Filed under: ,

    RubyGems not updating properly

    At times, i have noticed that running the:
    sudo gem update—system
    command does not properly update rubygems. It will say that everything is up to date.

    This has something to do with the way rubygems was installed on the machine. For example, if you installed rubygems with macports, it is possible that the macports package was slightly broken for this update procedure.

    If this happens to you, you can still up date rubygems like this:

    sudo gem install rubygems-update
    sudo update_rubygems

    Posted at on by | 0 comments | Filed under:

    Starting New

    I have moved off of a Typepad account.  I figured why pay for a blogging service.  Yeah, I could have done some sort of data migration.  But, there wasn't anything worth saving.

    Posted at on by | 0 comments | Filed under: