About the blog
This is the blog by the Ruby on Rails developers behind Mynewsdesk.
Read more about us →
Visit Mynewsdesk →Follow us on Twitter
Search
Blogroll
-
Recent Posts
Tags
@media Analytics bit.ly data attributes design developer e-commerce editor gchartrb git googlecharts Google Charts API google charts on rails hCard html5 i18n javascript jQuery JSON litespeed Microformats newsdesk Operator Optimus passenger plugin plugins pluralization postgresql RDFa Rich snippets ruby Ruby on Rails Semantic web SEO Services swedish swedish_pluralize The environment tip Transformator translate usability Validator XML
Author Archives: peter
Migrating RSpec to Mocha
I have been using the builtin RSpec mocking framework for a couple of years and haven’t had any issues with it. The one feature I have been missing though is the any_instance method of the Mocha framework. What this method … Continue reading
PostgreSQL Unreliable Default Sort Order and Random Rails Test Failures
We have been struggling with intermittent Rails test failures for quite some time. There were times when we blamed our search engine Ferret, sometimes we blamed database interference between tests, and sometimes higher powers. Lately we have realized that all … Continue reading
View Comments
Posted in Ruby on Rails
Rails 2.3.2 Bug – Sending Multipart Email Breaks When Current Directory is not RAILS_ROOT
We had the debugging session of the year here at Newsdesk the other day and we thought it would be prudent to warn other people about it. It turns out that ActionMailer in Rails 2.3.2 fails in sending multipart emails … Continue reading
View Comments
Posted in Ruby on Rails
Enabling/Disabling the Rails Cache
We needed a way to globally enable/disable the Rails cache so we came up with this patch: By default ActionController will use the Rails.cache (RAILS_CACHE) object configured by config.cache_store for its fragment caching (action caching is an around filter that … Continue reading
View Comments
Posted in Ruby on Rails
Announcing Cachable Model – A New Plugin For Caching Your Rails Models
When you scale a Rails website the database layer tends to become the bottleneck sooner or later as it’s more difficult to scale horizontally with hardware than the Ruby/web server layer. At MyNewsdesk we have started looking at database caching … Continue reading
Rails Gotcha: Mocking/Stubbing on an Associated ActiveRecord Object
In RSpec it is still not possible to have mocks or stubs on all instances of a class, although this has been suggested and it is a feature of the Mocha framework. Stubbing or mocking an object returned by an … Continue reading
View Comments
Posted in Uncategorized
Rails Tip: Safe Usage of URI.parse
As documented already by Doug URI.parse will thrown an exception if your URL has a trailing space. It also throws an exception on invalid URLs in general. To avoid having URI.parse bomb on your pages you can use a construct … Continue reading
View Comments
Posted in Uncategorized
Keep Your I18n Translation Files Tidy
I added the Rake task translate:remove_obsolete_keys that lets you remove all obsolete translations from your YAML files. How is a translation rendered obsolete? Suppose you are translating from english to a number of other languages. Over time you may end … Continue reading
View Comments
Posted in Ruby on Rails
Configuring Exception Handling in RSpec and Controller Tests
The ActionController::Rescue module in Rails defines a number of exceptions that will trigger a 404 response, namely ActionController::RoutingError, ActionController::UnknownAction, and ActiveRecord::RecordNotFound. However if you trigger one of those exceptions in a controller test (Test::Unit or Rspec) then rescue and display … Continue reading
View Comments
Posted in Ruby on Rails, Services
acts_as_bitfield Plugin now Radio Button Compatible
I’ve patched the acts_as_bitfield plugin to recognize “true” as true so that now instead of having to write: <%= f.radio_button(:email_activated, true, :checked => (“checked” if @item.email_activated?)) %> Yes <%= f.radio_button(:email_activated, false, :checked => (“checked” unless @item.email_activated?)) %> No you can … Continue reading
View Comments
Posted in Ruby on Rails, Uncategorized
Subscribe