Rails does a great job of inferring a lot of things based on names, so it seems like a good fit to me.

class User < ActiveRecord::Base
   has_many :assignments
end

From this class declaration, Rails infers that there is an Assignment model that contains the foreign key user_id. Isn't this the same kind of "magic" we are talking about?

Kevin Clark wrote:
See ActiveRecordTestCase in active_record_unit.rb in actionpack. I
defined a test_truth so Test::Unit::TestCase doesn't complain. The
test count is slightly inflated, but if you care enough about not
having request, response and controller instance variables setup then
it's an option.

Adding a default method is certainly less magic than guessing the
controller name.

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to