Today was the first day at railsconf, and I attended two tutorials: “Refactoring your rails application” and “CI for the rails guy/gal”.
First, I’d like to say that the tutorial format really doesn’t work well for large groups. Tutorials are best if the teacher/speaker can walk around the room and coach the attendants through a bunch [...]
Entries from maj 2008
Railsconf tutorial day
maj 30th, 2008 · Comments
Tags: railsconf · railsconf2008 · tutorials
Testing caching with memcache, cache_fu and rspec
maj 21st, 2008 · Comments
I use cache_fu for caching my rails application. I use a “fat models, skinny controllers strategy”. This means that my Author model has code like this:
def cached_books
get_cache(:author_books) do
Book.find_by_author_id(self.id)
end
end
This method caches all books belonging to an author. Cache fu does not cache belongs_to or has_(one|many) relationships, and that’s why we have this method. But this also [...]
Tags: Ruby on Rails · cache · memcache · rspec
Cache sweepers in Rails, put them in app/models!
maj 14th, 2008 · Comments
So i’ve been spending hours tracking this one down: I wanted to have cache sweepers in rails and followed the advice from railscasts and railsevny. Those tutorials tell you to put sweepers in an app/sweepers directory and add that directory to your load path. DON’T DO THAT. That simply did not work for me (using [...]
Tags: Ruby on Rails · cache · sweepers · tips
In place editing in rails
maj 13th, 2008 · Comments
So basically, the official plugin is old and cant really deal with restful routing. For some reason, when I used the url_for method in my views, the in place editor javascript function couldn’t interpret the (restful) route properly and sent a post request to ‘/controller/1/edit’ to an action named “1″ with an id set to [...]
Tags: REST · Ruby on Rails · tips
Talk at IHS, Sønderborg
maj 9th, 2008 · Comments
I gave a talk yesterday at IHS, Sønderborg. I talked about astronomy/astrophysics and black holes but the conversation also took us into neuroscience, atheism and the Moon hoax (there is no such thing, we did go to the moon).
IHS is a “højskole”, which is a special Danish type of educational institution. People go there to [...]
Tags: astrophysics · black holes · science · talks
Rails tips #1
maj 2nd, 2008 · Comments
These might be completely obvious to everyone, but I found them useful:
If you want to migrate a specific database, you can do it by setting RAILS_ENV on the command line. Like this:
rake db:migrate RAILS_ENV=production
If you want to see all the rake tasks in your application with a description of what they do, execute:
rake [...]
Tags: Ruby on Rails · tips
Plugins
maj 1st, 2008 · Comments
I decided to add a friendfeed widget in the sidebar instead of posting a daily digest of my tweets. No need to fill the rss feed with clutter. Also, I have enabled disqus on this blog, basically because it looked like a cool feature. Ofcourse it is only cool if someone comments on a post [...]
Tags: disqus · friendfeed · plugins · wordpress
Site revamp
maj 1st, 2008 · Comments
This site has been revamped and is now in English. The old format wasn’t working for me, because a) I actually think running a business is boring and b) If I’m writing about code it should be in English so that others might benefit from it.
This site will now aggreate my feeds from various social [...]
Tags: del.icio.us · site · twitter