It looks like this common code could be pulled into a shared partial. Also, it's preferred to name routes and use rails helpers.