So I like using ERB for views and have it implemented something like this:

render t
  content = ERB.new(File.read "./some_app/views/#{t}.erb").result binding
  ERB.new(File.read "./some_app/views/layout.erb").result binding
end

So, effectively I have no Views module. However, I'd like to make use
of some partials as well. I can make a method for every partial and
throw it in the Helpers module but that doesn't seem like the right
road. Does anyone have any suggestions? I tried creating a partial
method in the main module:

def partial p
  ERB.new(File.read "./some_app/partials/#{p}.erb").result binding
end

And then tried overriding missing_method to be fancy:

def missing_method symbol, args*
  p = symbol.to_s
  if p[0] == '_'
    partial p
  else
    super
  end
end

So I could call partials like this '_some_partial' but as the
Controller is calling render, I would have to do this in every
controller class I think. Does anyone have other suggestions?

-- 
Dave
_______________________________________________
Camping-list mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to