On a site I’m working on I started noticed a lot of production errors like this: ActiveRecord::StatementInvalid: Mysql::Error: Lock wait timeout exceeded; try restarting transaction: UPDATE users SET counter = 2, updated_at = ‘2010-08-05 20:54:26’ WHERE id = 1234 I traced the error back to a call in the user model: update_attribute(:start_time, DateTime.now) increment!(:counter) </pre>…
Category: Ruby On Rails
Textmate RSpec Bundle Error
After installing the Textmate RSpec bundle I started getting this error: /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in `blank_slate_method_added’: stack level too deep (SystemStackError) from /Applications/TextMate.app/Contents/SharedSupport/Support/lib/builder.rb:86:in `blank_slate_method_added’ from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:84:in `method_added’ from /Library/Ruby/Gems/1.8/gems/builder-2.1.2/lib/blankslate.rb:104 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’ from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’ from /Users/jbasdf/projects/red/vendor/rails/activesupport/lib/active_support/basic_object.rb:21 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’ from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’ … 32 levels… from /Users/jbasdf/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:36:in `chdir’ from /Users/jbasdf/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:36:in `run’ from /Users/jbasdf/Library/Application Support/TextMate/Bundles/RSpec.tmbundle/Support/lib/spec/../spec/mate/runner.rb:24:in `run_focussed’…
Fireeagle and PortableContacts Don’t Get Along. That Makes Daddy Mad.
I have some code that looks like this: user.google.portable_contacts.all </pre> As long as user.google is a valid token provided by oauth you will get back a list of the user’s contacts from gmail. That is unless you have the Fireeagle gem included in your application. In that case you will spend the night swearing like…
Don’t Upgrade to Rails 2.3.8 Unless You Really Mean It
I just got a new laptop which means re-installing everything. This included Rails and I ended up with 2.3.8. Most of my projects use 2.3.5. I figured no big deal since various Rails versions have always played together in the past. I installed 2.3.5 with gem install rails -v=2.3.5 and figured all would be well….
Setting Up mysql as utf8 for Ruby on Rails using homebrew
It took me far to much time to get this to work right so hopefully this is helpful for someone (probably me at some point in the future). The hashrocket guys have a great writeup on configuring your development environment. I didn’t need some of their bash configuration but it’s a great starting place. Once…
Mountain West Ruby Conference
I spent last week at the Mountain West Ruby Conference which is by far the best conference I’ve ever attended due to the brilliant minds that gather from all over the country. This year Yukihiro Matsumoto (Matz), the creator of ruby came from Japan to provide his aura to to adoring minions. I had the…
Add Theming Engine to Your Rails Application
I’ve written about the disguise gem before, but I’ve made enough changes that it warrants a new blog post. I noticed a few performance problems which have now been fixed and the configuration has been cleaned up a bit. Disguise makes it simple to swap out the views used by your rails application either by…
acts_as_taggable libraries and the big case problem.
Over the years I’ve had a chance to use the three tagging libraries available for Ruby on Rails: acts-as-taggable-on acts_as_taggable_on_steroids acts_as_taggable I think the original acts as taggable is now defunct. The other libraries are derivatives of that library. In using tags on various sites the problem I always seem to run across is how…
undefined method `assert_no_difference’ and `assert_difference’
I’ve been upgrading some old code and noticed that my unit tests started spitting out a lot of errors like this: undefined method `assert_no_difference’ </pre> and undefined method `assert_difference’ </pre> It turns out that I needed to change my base classes from Test::Unit::TestCase to ActiveSupport::TestCase: class UserTest < Test::Unit::TestCase # stuff end </pre> changes to:…
Using the OAuth and OAuth-Plugin gems
For quite a while I’ve been wanting to play with OAuth and now that I’ve been able to spend some time playing with it I have to say it is awesome. Instead of asking for a user’s username and password for a given service (like their GMail or LinkedIn account) you instead have the user…