Skip to content

Tag Archives: rails

Making your Plugin or Gem configurable

Recently I added a configuration mechanism to Webrat. It was surprisingly easy, and mainly copied from rails core. I would suggest adding somthing like this to any plugin that has more than a few features or ones that users have asked to have turned off. First off you’re going to have to create the actual […]

hiding production database info from source control with capistrano

Whether you are working on an open source app or an enterprise app, it is a good idea to keep the production database connection information out of source control. To do so, add the following to your deploy.rb file: task :overwrite_database_yml_file do run "[ -f /var/rails/#{application}/database.yml ] && cp -f /var/rails/#{application}/database.yml #{latest_release}/config/ || echo 'database.yml […]

new has_a block

Pretty simple post, but any ruby object can be post conifged in a line with somthing like: => “tony”){|u|} which is great for active record tests. Or in a bigger example: @trip ={|t|!} @invite1 = => users(:aaron), :status => Invitation::STATUS_MAYBE){|i|} @invite1 = => users(:aaron), :status => Invitation::STATUS_MAYBE){|i|}

rcov and rails

rcov and Rails I had the good fortune of attending Rails Conf recently on behalf of the consulting company I work for, Asynchrony Solutions. One of the topics at the great Refactotem tutorial (hosted by the guys from Relevance) was rcov, a code coverage tool for Ruby. One of the things I missed in, or […]

laying out sections using content_for

For the new style changes for confabulus, I made use of the content_for capabilities in rails. The currently has two sections, main and sidebar. content_for makes implementing this quite easy. In your layout file (example application.html.erb under app/views/layouts), you use a to place each of the sctions. Here I used to include my sidebar section. […]

New Layout, Contact Lists, Registration/Forgot Password Added

I just pushed out a large upgrade that I did while on Jury Duty and at Rails Conf. New features include: New design (Much cleaner and easier for me to group elements) Removed extra pages for managing cars, flights, and hotel rooms (I’m trying to keep all of the main work flow on one page. […]