authlogic plugin error/fix

I’ve seen this error lots and lots of times dealing with authlogic plugins:
rake aborted!
undefined method `add_acts_as_authentic_module’ for ActiveRecord::Base:Class
And I’ve searched on the web for answers and there’s not a really good source as to why it happens or what can be done to fix it.  Yesterday, I put an end to the error in authlogic_facebook_connect [...]


counter_cache as an optimization step

I had a debate with a programmer friend of mine once about optimization. I argued that once you get past adding indexes to a relational database, every attempt at increasing its speed or scaling is an act of denormalization. Whether its double storing information in the database in such a way that it [...]


find_by_param for permalinks

A nice, clear, declarative means of doing something I’ve been writing code to do for years … find_by_param
From the README:

Find_by_param helps you dealing with permalinks and finding objects by our permalink value
class Post < ActiveRecord:Base
  make_permalink :with => :title
end
now you can do Post.find_by_param(…)
If you have a permalink-column find_by_param saves the permalink there and uses that otherwise it [...]


Handling ajax-y file uploads

I’m working on a site for a client where a user needs to upload a logo for their newly created widget.  The client wants the logo to be visible during the widget creation process (so the user can make sure the logo they’re uploading is correct).  A user can add multiple widgets all at the [...]


authlogic_oauth gotcha

I don’t want to imply by the title this is anyone’s fault but my own.  But since it took me two days to figure out, I thought I’d share.
I’m using the excellent authentication package, authlogic, for my current project.  I want to allow normal registrations through my site and also registrations using Twitter credentials.  In [...]


Rails 2.3.1+, Passenger, and Rack 1.0

Just an FYI for those of you running the latest stable Rails.
Rails 2.3.1+ depends on Rack 1.0.  In 2.3.1, it only uses the vendor’d version of Rack 1.0 (which is located under action_controller/vendor).  In 2.3.2, it can use a vendor’d version of Rack 1.0 if the gem isn’t installed in your system.  Rails 2.3.3 depends [...]


Rails running in script/console?

If you ever wanted to know if your application is running normally or in console mode, here’s the trick:
def in_console?
Object.const_defined?(:IRB)
end
This would break if you require’d IRB in your Rails application normally, though I can’t possibly imagine why you would.


deploy:web:disable and Dreamhost

Following on the heels of Twitter on your maintenance page, the other piece of custom setup I needed for this solution to work was making the site swallow all incoming requests while disabled in order to show the maintenance page.  In the past on sites using Nginx+thin/mongrel the setup has been in the nginx configuration [...]


Twitter on your maintenance page

I recently started a new project.  Because the domain was purchased, one of the first acts of business was a, “Coming Soon,” page.  I decided the maintenance/deploy:web:disable page was the perfect solution.  I could put it up in production and leave it off in staging without special code shenanigans.  It would be re-usable for the [...]


Setting up test:benchmark

I’m in the process of trying to establish some baseline performance metrics for increasing the performance of a website.  I thought I’d share what I learned.
The first place to start is Performance Testing Rails Applications from Rails Guides.  Everything else in this post assumes you started there (which is what I did).
Changing the host for [...]


← Before