Carl Jackson's blog



Carl JacksonCarl Jackson
Standup 3.25.2011:
edit Posted by Carl Jackson on Friday March 25, 2011 at 01:20PM

Help

  • fonts.com is giving 404s, it appears their CDN is down
  • How do you style a File Input? There are several jQuery plugins that do this, one that worked well (and includes drag & drop support) is jQuery-File-Upload
  • Selenium + Webrat, oh my: If you try adding selenium tests to an existing test suite you may find that your test database data gets blown away. A good solution to this is to separate your selenium tests into another test suite and run them separately

Interesting

  • assert_template is just doing a regex, which means that it may incorrectly be passing if you are asserting on a string that is a substring of the actual template name you expect

Carl JacksonCarl Jackson
Standup 3.23.2011: update your rvm, bundler 1.0.10 fix, autofocus in WebKit
edit Posted by Carl Jackson on Wednesday March 23, 2011 at 10:20AM

Interesting things

require 'yaml'
YAML::ENGINE.yamler= 'syck'
  • autofocus attribute + hover css rule in WebKit may not play nicely with each other

Carl JacksonCarl Jackson
Standup 3.21.2011: Deactivating users in devise
edit Posted by Carl Jackson on Monday March 21, 2011 at 09:19AM

Interesting Things

All strategies that inherit from Devise::Strategies::Authenticatable (which may be all right now) check for user.active?. To deactivate a user, just add an active column to User model, and a message to present with inactive_message:

# User model

def active?
  !!active
end

def inactive_message
  "Sorry, this account has been deactivated."
end

and to test:

# Any session controller spec

it "should throw an error with an inactive user" do
  user = Factory.create(:user, :password => "password")
  user.active = false
  user.save!

  error = catch(:warden) do
    post :create, :user => {:username => user.username, :password => "password"}
  end

  error[:message].should =~ /deactivated/
end