Database design - Bussiness/Contacts/Categories etc...

The associations would be as follows:

business.rb   has_many :contacts   has_many :photos   has_and_belongs_to_many :categories   has_and_belongs_to_many :sub_categories

contact.rb   belongs_to :business   has_many :photos *Could be has_one if they only have one photo

category.rb   has_and_belongs_to_many :businesses

sub_category.rb   has_and_belongs_to_many :businesses

business_photo.rb   belongs_to :business

contact_photo.rb   belongs_to :contact

With regards to the cities, I would change your schema so that the business/contact record "belongs_to" a city. Under your current schema, if you had two separate companies in New York, you would need two entries in the city table. Why are you using a separate city model anyway?

Again, with (sub)categories, under your current schema, you could end up with separate entries for the same (sub)category. You need a join table named businesses_(sub)categories with schema:

business_id (sub)category_id

Your (sub)category table would then just consist of "name" and "id".

Also, if the same contact can apply to more than one business, you would need a HABTM association

Regards

Robin