Added railtie and code cleanup
remove deprecation warning from recent versions of rails.
Final fixes