Quantcast
Channel: User BvuRVKyUVlViVIc7 - Stack Overflow
Viewing all articles
Browse latest Browse all 42

Answer by BvuRVKyUVlViVIc7 for Dynamic concerns with inheritance not loading twice, but only once

$
0
0

Actually it's a feature of Rails that the same module doesn't get loaded multiple times.

We started to use the normal ruby module inclution hooks and it worked fine!

module CustomConcern  def self.included(base)    custom_class_lookup_paths = ["#{HOSTNAME.camelize}::Models::#{base.name}PrependConcern","#{HOSTNAME.camelize}::Controllers::#{base.name}PrependConcern"    ].map{|class_string| class_string.safe_constantize }.compact    custom_class_lookup_paths.each do |class_string|      base.send :include, class_string    end  end

Viewing all articles
Browse latest Browse all 42

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>