In your application_controller application, do the following:
before_filter :load_projects
def load_projects
@projects = Project.all
end
This will run the load_projects method for each request and populate the @projects variable.
You can also add conditions for your filter before the following:
before_filter :load_projects, :only => [:index]
def load_projects
@projects = Project.all
end
More about ActionController filters: