Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Rails plugin namespace strategy

 
Ranch Hand
Posts: 218
VI Editor Ruby Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am interested to know what is the best namespace strategy in developing rails plugins to prevent collision. I know it is common theme in ruby development, but it seems to be much more important with rails plugins as it rely a lot of rails behavior and a lot of magic metaprogramming going on.

How can we make sure we are not stepping on each other toes?
 
author
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's certainly possible to create conflicts if unique module/class names aren't used. My advice would be to use nested modules in your plugin code to create a namespace. Then, in your init.rb hook, you can graft these methods onto ActiveRecord (or any other pre-existing piece of Rails) by referencing them thusly:

 
Create symphonies in seed and soil. For this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic