分享 最小的 Rails app

poshboytl · 2012年06月01日 · 最后由 poshboytl 回复于 2012年06月01日 · 2068 次阅读

http://thesmallestrailsapp.com/

有点意思 :D

%w(action_controller/railtie coderay).map &method(:require)

run TheSmallestRailsApp ||= Class.new(Rails::Application) {
  config.secret_token = routes.append { root to: 'hello#world' }.inspect
  initialize!
}

class HelloController < ActionController::Base
  def world
    render inline: "
      <!DOCTYPE html>
      <title>The Smallest Rails App</title>
      <h3>I am the smallest rails app!</h3>
      <p>Here is my source code:</p>
      #{CodeRay.scan_file(__FILE__, :ruby).div(line_numbers: :table)}
      <a href='https://github.com/artemave/thesmallestrailsapp.com'>Make me smaller</a>
    "
  end
end

好像有人发过了。。。

#1 楼 @hooopo oh.....是吗?晕~~~ 我 out 了...

#3 楼 @hooopo 忙了段时间果然成奥特曼了... 那就让他沉掉吧,.... :p

需要 登录 后方可回复, 如果你还没有账号请 注册新账号