Upgrade to Rails 4 and changes to ap