fixes #3268, #2783 - Update prod2dev to handle fkeys in psql

(cherry picked from commit f2cddb6be2e68958350081c72068c79ca26a656b)
fixes #3603 - replaced a relation with a collection in 'where' conditions

(cherry picked from commit 9e08f306472c16c8c019fe7c038b5cb44bd5a28e)

Conflicts:
	app/controllers/puppetclasses_controller.rb