Added dependency ordener and support for activerecord 4