With the first release candidate of Rails 2.1 now out, I’ve tested friendly_id against it today. Yeah, I’m not really a big “edge” guy. In case anyone was worried, it appears to work fine. Let me know if you discover otherwise.
I’ve been working with Git for the last few weeks and have decided to move friendly_id over to Github. The svn repository will remain live for at least a month of so after Rails 2.1 is released, since the support for git-hosted plugins is currently only available in Edge Rails.
For now, all development is being committed to Git, and then patched into the svn repository. So, if you’re using the svn repository don’t worry, it will remain current for a while.
I remember first hearing about Git during the Linux/Bitkeeper contoversy, and recall thinking Linus Torvalds was odd for not using CVS or Subversion over Bitkeeper, and then thinking he was certifiably insane for deciding to roll his own version tracking system once Bitkeeper didn’t work out.
Of course, Linus Torvalds is (a) a better programmer than me and (b) smarter than me, so there you go. Git has evolved into a very nice tracking system; for me everything that was slow and annoying in SVN (namely, comparing revisions and branching) is fast and easy using Git. If you haven’t yet taken a look at it, you should.
You can take a peek at the shiny new friendly_id repository here.
If you’d like to see a quick introduction to Git, take a peek at Sebastian Delmont’s presentation below.
GIT Talk (nyc.rb) from Sebastian Delmont on Vimeo.
I got stuck for a few minutes trying to figure out how to write a unit test to check if a value was being set in the flash using flash.now. In Rails’ Test::Unit you can’t just do something like assert_not_nil flash[:notice] because the flash value is discarded at the end of the request, and so the flash is always nil.
The solution is to use Mocha to mock an instance of ActionController::Flash::FlashHash and capture the value being set. Here was my solution:
def test_create_with_empty_email_sets_error_in_flash
hash = {}
ActionController::Flash::FlashHash.any_instance.expects(:now).returns(
hash
)
post :create
assert_not_nil hash[:error]
end
I have been tripping over this for days and finally, though the miracle of this thing called Google, found a mailing list post describing exactly how to do it. Here it is, relinked so that others may find it.
Don’t you ever feel really dumb when you realize that what you’ve been trying to do for days is actually so easy? I haven’t worked as a sysadmin for 4 years now and find my skills have really atrophied… but anyway… thanks to the Google gods I have managed once more to get away with it.
I decided to move the blog over to WordPress rather than Typo. I really wanted to like Typo, because I like Rails. But the fact of the matter is that WordPress is just much better software and so I decided to move things over to it.
Just because Rails is good is not an excuse to avoid using quality software written in another programming language. I know a lot of Rails developers dislike PHP but I’m happy to work with good software - especially free software - no matter what language it’s written our in. And this blog was never meant to be a “Rails blog,” we here at Randomba also work with C++, Java, PHP, Perl, Objective C, Cocoa and a lot of other languages/frameworks. Yes, we CAN all get along.
We just happen to be doing a lot of Rails stuff lately.
Anyway… this means that I need to apologize to the thousands hundreds several people that left comments on the previous blog; it was a little complicated to port them over, and I got lazy and decided to leave them. This should be the last time it happens, I promise.
Code