I've got an app which uses app-wide slugs (uses Slugalicious gem with Sluggable table), and have routed to these slugs by using this code:
#Slugs
begin
Slug.all.each do |s|
begin
get "#{s.slug}" => "#{s.sluggable_type.downcase.pluralize}#show", :id => s.slug
rescue
end
end
rescue
end
I currently update the routes when I update the slugs model with this code:
after_save :update_routes
def update_routes
Rails.application.reload_routes!
end
This works perfectly in dev:
The problem I'm getting is that if I update or create a new slug, Heroku doesn't update to accommodate it. It works in development, and (confusingly), it works if I do "heroku run rake routes" on Heroku. But the app just shows a 404 if I try to browse to the new URL. If I redeploy the app, all the routes work, which leads me to believe it's something to do with updating the routes app-wide
This question said it's something to do with running multiple processes on Heroku, but I've yet to find this.
Any ideas? Many thanks in advance