This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Ruby and the fly likes Rails plugin namespace strategy Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Languages » Ruby
Reply Bookmark "Rails plugin namespace strategy" Watch "Rails plugin namespace strategy" New topic
Author

Rails plugin namespace strategy

Wirianto Djunaidi
Ranch Hand

Joined: Mar 20, 2001
Posts: 195
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?
Nick Plante
author
Greenhorn

Joined: Sep 01, 2008
Posts: 13
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:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Rails plugin namespace strategy
 
Similar Threads
Rails plugin extension to rails app
Usage of CalendarDateSelect in Ruby
output of DTD Validation.
What is Rails ?
Top three (or more) plugins