Rails 4 fixes and layout initialization