has_many :through and callbacks
2007-04-27 Reading this a little bit earlier would have saved me a lot of time. In short: callbacks such as
:before_adddoes not work withhas_many :through, and the documentation does not tell you that. To get callbacks, add them to the join model.Another Mercurial Convert
2007-04-17 Paul Duncan is another Mercurial convert, and explains his choice of VCS very well
RSpec, Autotest and views
2007-04-17 The current incarnation of autotest seems to assume that you are using integrated views. If not, you can modify the rspec_rails_autotest.rb file to run the view specs as well:
:::ruby # when %r%^app/views/layouts/(.*)\.rhtml% then # ["spec/views/layouts/#{$1}_spec.rb"] when %r%^app/views/(.*)\.rhtml$% then ["spec/views/#{$1}_view_spec.rb"]Your view spec must be postfixed with “_view_spec.rb” for it to work
Update This works out of the box now.
Autotest 3.5.0 and Growl
2007-04-13 Autotest 3.5.0 is out, and the result given from Autotest is no longer a String, it’s an array of strings. So if you still want Growl to function properly just modify the .autotest slightly:
#ruby module Autotest::Growl def self.growl title, msg, img, pri=0, stick="" system "growlnotify -n autotest --image #{img} -p #{pri} -m #{msg.inspect} #{title} #{stick}" end Autotest.add_hook :ran_command do |at| output = at.results.last.slice(/(\d+)\s.*specifications?,\s(\d+)\s.*failures?/) if output =~ /[1-9]\sfailures?/ growl "Test Results", "#{output}", '~/Library/autotest/rails_fail.png', 2 #, "-s" else growl "Test Results", "#{output}", '~/Library/autotest/rails_ok.png' end end endAny Damn Fool
2007-04-11 Tim Bray is my hero of the day. So many other people would defend their brainchild, especially a world conquering one, in any situation but Tim clearly stands above such behavior.
Any Damn Fool: “… we designed XML as a document format. When the world gleefully seized upon it as a data-packaging/RPC tool, that was OK, but I doubt you could get any of XML’s original designers to disagree with the statement that JSON, for example, has all sorts of advantages for wrapping up short-lived strongly-typed data.”
Google issue solved
2007-04-11 I’ve previously mentioned that I’ve unsuccessfully tried to migrate my personal domain to Google Apps. I also blamed Google for it not working. I was wrong.
It seems that Textdrive has some nifty Apache security going on which denies the Jakarta HttpClient to connect, returning a “412 - Precondition Failed”. Big thanks to Doug for finding this out.
RSpec and Autotest
2007-03-30 I am getting all parts of my Rails development environment settled. In addition to vanilla Rails, I am currently using RSpec, Selenium and Autotest. I am seriously considering Haml and Sass as well.
When googling arounf to learn more about Autotest, I realized that people are using together with Growl. It works out-of-the-box with Test::Unit, but RSpec needs a little tweaking. I took the basics from here and modified to my liking. The following is what my .autotest looks like.
Google Apps - Heaven and Hell
2007-03-13 We’re using Google Apps at Re:mind which is really, really great. So great in fact that I wanted to move my private mail there as well. So after setting the domain up, I created the webpage that was needed for domain activation, put it on my server, clicked the “verify my domain”, and got the usual “this may take 48 hours to complete”
It has now been almost two weeks or something like 300 hours, slightly more than 48. I have sent Google a support email asking what is happening, but I have yet not received an answer. To that mail that is
Spring Is In the Air
2007-03-13 Spring surprised us early this year, so we are currently blessed with a mild 10ºC. As everyone who has ever experienced it knows, the early days of spring after the long dark winter are just wonderful
The photo is taken with my SE K610i, and stitched together with DoubleTake, which deserves a mentioning. I noticed today that I had lost my license for it, so I sent an email to EchoOne explaining the situation. I got a reply with my license within 4 hours. Great stuff.
New Job in Startup Land
2007-02-27 I almost forgot to mention it, but I have a new job. Again some might say.
After being a consultant for 1.5 years with Valtech Sweden, I am back in startup land. This time it is really, really startup. We registered our domain last friday, we do not have a web site yet, we are all sitting in one room on broken chairs. Ok, one broken chair. Mine is actually the good one.
