2017-05-01 16:46:30 -04:00
|
|
|
module RoutableActions
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
def ensure_canonical_path(routable, requested_path)
|
|
|
|
return unless request.get?
|
|
|
|
|
|
|
|
if routable.full_path != requested_path
|
2017-05-04 14:12:19 -04:00
|
|
|
flash[:notice] = 'This project has moved to this location. Please update your links and bookmarks.'
|
2017-05-01 16:46:30 -04:00
|
|
|
redirect_to request.original_url.sub(requested_path, routable.full_path)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|