Complete conversion from sinatra to rails