All posts tagged: rails

Devise Omniauth Dynamic Providers

programming / rails

My current project www.viewshound.com requires different users to have different scopes for their Facebook authentication. Warden supports dynamic providers out of the box. To get it working with Devise was pretty easy, just a couple of minor changes were needed especially to support Facebook. First up was creating the new route. As I’m using a controller called Omniauth and not Session, the :to attribute is different. The other thing to note is I’m matching /users/auth/facebook/setup, […]

Thoughtbot Clearance & mongomapper

rails

Having a play with mongomapper and wanted to get Clearance working with it. Seemed to just be a simple case of doing the following in my user model. [crayon-5f70646426d3a791529864/] My full user model ended up looking like this: [crayon-5f70646426d45288587754/] Perhaps if I have time, I will look into adding attr_accessible support to mongomapper myself. Update 13/03/2010: I believe the dependency on attr_accessible in clearance has since been removed. So this small hack is most probably […]

Law of Demeter and the delegate method

computing / rails

The Law of Demeter, or Principle of Least Knowledge is a fairly simple design pattern, which, simply put means that an object should only talk to it’s immediate “friends” The law states that a method M of and object O may only invoke the methods of the following kind: 1. a method on O itself2. any parameters passed to M3. any objects instantiated within M4. any direct components of O The classic example coined by […]

Vlad 2.0 Not Finding Tasks in deploy.rb

computing / programming

When I restalled all my gems on Snow Leopard, vlad refused to find any of the tasks I had defined in my deploy.rb. I thought this was a SL issue but turned out a week before it’s release Vlad had been updated to version 2 which used a new plugin system. Looking for vlad rake tasks returned an error: To solve the problem just required an install of the new vlad-git gem. Now all my […]

rake spec fixtures failing

programming / rails

For some reason my rspec fixtures were not loading into my development database when doing spec:db:fixtures:load. An extra parameter to db:fixtures:load is all that’s needed. [crayon-5f70646426f93256046231/] Fixed by: [crayon-5f70646426f97909585706/]

RSpec + Autotest + Growl + Doom Guy

computing / programming

I spent this morning playing around with autotest, but was getting really flaky results with the Growl notifications. I tried about four different autotest configs, but none of them seemed to consistently worked. I remembered that the Growl notifications at Thursday’s Coding Dojo worked pretty well, so after some digging around I found the config on their github. After a tiny tweaking I was even able to get it to work with Przemysław Kowalczyk’s Doom […]