<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><DIV><DIV>On May 7, 2007, at 1:31 PM, Joshua Schairbaum wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I'm wanted to make a "global" module that I could include in my</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">application for some shared code between them.<SPAN class="Apple-converted-space">  </SPAN>I've been making</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">several camping apps and wanted them all to share a helper/partial</DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">that contained the navigation.</DIV></BLOCKQUOTE><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I think the root of the "problem" is the way the app modules are loaded into the Markaby rendering context:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>  module Views; include Controllers, Helpers end</DIV><DIV>  class Mab &lt; Markaby::Builder</DIV><DIV>      include Views</DIV><DIV>      def tag!(*g,&amp;b)</DIV><DIV>          h=g[-1]</DIV><DIV>          [:href,:action,:src].each{|a|(h[a]=self/h[a])rescue 0}</DIV><DIV>          super </DIV><DIV>      end</DIV><DIV>  end</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Here's a slightly unnerving hack which seems to solve the problem.  You pass it the base module (or symbol of) your Camping app and one or more shared helper modules, and it'll inject them into your Camping app.  (Obviously the symbol parameters won't work if you have nested modules...you'll have to pass in the module constant instead...the symbols are just syntactic sugar to echo Camping.goes().)</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>class TentSteak</DIV><DIV>  def self.bootstrap(mod_or_sym, *appmods)</DIV><DIV>    @@rootmod = mod_or_sym.instance_of?(Module) ? mod_or_sym : const_get(mod_or_sym.to_s)</DIV><DIV>    inject appmods</DIV><DIV>  end</DIV><DIV>  def self.inject(*mod_or_syms)</DIV><DIV>    @@rootmod.module_eval "class Mab &lt; Markaby::Builder; include #{mod_or_syms.join(', ')}; end"</DIV><DIV>  end</DIV><DIV>  def self.view_method_defined?(meth)</DIV><DIV>    @@rootmod::Mab.method_defined?(meth)</DIV><DIV>  end</DIV><DIV>end</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>Usage is like this:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>  Camping.goes :MyApp</DIV><DIV>  TentSteak.bootstrap :MyApp, :MyHelperModule, :MyOtherHelpers</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>I'd love to hear if there's a better way to do this injection.  Seems pretty hacky.  Incidentally, TentSteak is a Camping helper library I've been working on recently.  I'll upload it to rubyforge as soon as I get the ugly corners chiseled off and properly tested/documented....</DIV></DIV><DIV><BR class="khtml-block-placeholder"></DIV>John<BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><BR class="Apple-interchange-newline"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>"The Internet is not something you just dump something</DIV><DIV>on.  It's not a big truck.  It's a series of tubes."</DIV><DIV> --Senator Ted Stevens, R-AK</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>John R. Sheets</DIV><DIV><A href="http://bark.metacasa.net">http://bark.metacasa.net</A></DIV><DIV><BR class="khtml-block-placeholder"></DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "></SPAN><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN> </DIV><BR></BODY></HTML>