How does a controller know its model?

I'm browsing the source of a version of rails I checked out today.

I want to understand how a Controller called ProjectsController knows that it should look for a model call Project and does whatever it has to do to say their married.

Would anyone be able to give me an idea where I should be looking? I'm browsing in the ActionPack, but I could be way off here.

Controller's don't look anywhere but the ruby load path for models. By default, Rails adds app/models, app/controllers, lib, etc to the load path. But, you won't find any specific spot in the ActionPack code where it "looks" for the model. It just expects the model constant (Project in your example) to be available.

This isn't the right forum for these questions. Please ask further ones in the rubyonrails-talk forum. rubyonrails-core is for discussion on future versions of Rails.