Search code examples
ruby-on-railsactivesupport-concern

How to use two concerns with the same name?


I want to use concerns app/controllers/concerns/likeable.rb and app/models/concerns/likeable.rb. The first one goes to controllers and the second one goes to models.

If I create two files, only the first one is loaded.

What's the best way to solve this problem?


Solution

  • I didn't find a way to use controller and model concerns with the same name without any namespaces.
    So, my final solution is to use LikeableModel and LikeableController concerns.