Working version upgrading to rails 4. See more comments...