I'm trying to share routing concerns of my engine with the host application.
What I'd like to achieve is the following:
# MyGem/config/routes.rb
Rails.application.routes.draw do
concern :commentable do
resources :comments
end
end
# HostApp/config/routes.rb
Rails.application.routes.draw do
resources :posts, concerns: :commentable
end
Which results in No concern named commentable was found!
.
I've tested just using the resource without the concern, and I can tell that the host is inheriting my routes, just not concerns.
This could be a load order issue, if the engine routes are loaded last. Which would explain why I could still see the resources comments.
The only thing I can think of is a building a method similar to devise_for :model
.
Something along the lines of mygem_concerns
, I suppose.
If anyone has any other suggestions I would truly appreciate the help.