This information is applicable to the United States only. The process, requirements, and terms are different in other parts of the world.
A credit rating (different from a credit score) is the ultimate deciding factor in determining whether or not a person gets a loan. A credit rating is decided by the actuarial section of the loan department at a financial institution, such as a bank or credit union. They determine this rating based upon a number of factors, the most common and well-known factor being the credit score. Other factors include various assets, such as property, stocks, bonds, equipment, receiveables (such as lawsuit settlements or lottery payments, as well as reliable income from a job), and cash-on-hand. Typically, the most important of these is the credit score, which is essentially a numerical representation of your credit history - a record of all loans, payments, collections, credit-cards and related accounts, and other credit-related bills. The reason a credit score is usuallly the most important is because most people do not have larg amounts of cash, property, or other assets to guarantee the repayment of the loan, nor enough regular income to justify lending large amounts.
Please note that, as always, this is not set in stone, and there are exceptions (students loans, for example, tend to bank on the future rather than the past). Also note that various people (inlcuding people who work for financial institutions) tend to use the terms in bold interchangeably due to ignorance.
It's also worth noting that simply beign approved for a loan does not mean you have a good rating - the loan amount and the interest rate together determine the quality of your rating and subsequent approval.