patching for rails 4

* I replaced `find_all_by_xxxxxx` method to `where` to let Rails4 projects can use this gem.
* I fixed the way to get the foreign keys to let custom foreign keys to be used.