topfunky (owner)

Revisions

gist: 22215 Download_button fork
public
Public Clone URL: git://gist.github.com/22215.git
Embed All Files: show embed
merb-flat-sample.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# OUTPUT
# Called with: foo : html : flatapp_rc5
# Called with: flatapp_rc5 : html : flatapp_rc5
# Called with: application : html : flatapp_rc5
 
class FlatappRc5 < Merb::Controller
 
  def _template_location(action, type = nil, controller = controller_name)
    puts "Called with: " + [action, type, controller_name].join(" : ")
    # This works better for taking advantage of views/application.html.erb
    controller == "application" ? "application.#{type}" : "#{action}.#{type}"
  end
 
  def index
    "Hello, I am flat Merb application. I only have one single file for the application, single file for configs and routes, and a directory for views."
  end
 
  def foo
    render
  end
  
end