分享 最小的 Rails app

poshboytl · June 01, 2012 · Last by poshboytl replied at June 01, 2012 · 2074 hits

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

You need to Sign in before reply, if you don't have an account, please Sign up first.