ruby - Nesting modules inside of a Rails eninge gem -


what proper syntax nest child modules within parent module being isolate_namespace rails engine gem?

# lib/myengine/engine.rb module myengine   class engine < rails::engine     isolate_namespace myengine     # def ...   end end 

for example. parent module myengine , child module blog. myengine share common domain, crud, taggable, searchable, etc, keep gem code dry , isolated main app (myapp), while inheriting isolated namespace , engine.

are either of 2 approaches correct? refactor advice?

# # lib/myengine/blog.rb module myengine   module blog     # def ...   end end  # b # lib/myengine/blog.rb module myengine   class engine < rails::engine     isolate_namespace myengine     module blog       # def ...     end   end end 

option a. correct, should lib/my_engine/blog.rb. can read more ruby & rails naming conventions here.

further, if want put more modules or classes under blog namespace put them in folder lib/my_engine/blog , nest them under myengine::blog.


Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -