Archive for the ‘ruby and rails’ Category
Friday, March 14th, 2008
If you use the restful_authentication plugin, you've probably run up against :false. If not, let me explain:
Restful_authentication provides a method called current_user. If someone's logged in, the method returns his or her User object. If no one is logged in, though, current_user returns :false. This is (for me, at least) ...
Posted in ruby and rails | 5 Comments »
Friday, March 7th, 2008
Just a quick couple of reasons why you should not use HABTM:
It's too magical. The join table is hidden, and with the emphasis on has_many :through the documentation is less available for HABTM.
The vast majority of the time, your join model already or will soon have additional data that is ...
Posted in ruby and rails | 5 Comments »
Wednesday, March 5th, 2008
Generally, when you run your tests in a Rails app you get something like this:
Started
.................E...................
1) Error:
test_editors_for_returns_none_for_selection_if_no_editors(PagesHelperTest):
ActiveRecord::StatementInvalid: Mysql::Error: Unknown column 'images.user_id' in 'where clause': SELECT * FROM `images` WHERE (`images`.user_id = 1) LIMIT 1
test/unit/pages_helper_test.rb:20
all_tests.rb:1
You may have noticed that ...
Posted in ruby and rails, testing | 1 Comment »
Wednesday, February 27th, 2008
Over the past couple of days, I've run into two separate problems caused by gems being installed on one machine and not on another. Fool me once, right?
So I spent a little time last night writing up a rough dependency-finder gem: Depth Charge. As of the 0.0.1 version, it gives ...
Posted in gems, ruby and rails | No Comments »
Monday, February 25th, 2008
(I always wanted to write one of those "considered harmful" posts)
In case you haven't realized it yet, if you're writing a RESTful application in Rails 2, you should probably delete the default route at the bottom of your routes file:
map.connect ':controller/:action/:id'
The reason is that this provides a back-door into any ...
Posted in rest, ruby and rails | 4 Comments »