gem install rails
rails new my_app -T
#!/usr/bin/ruby | |
class Object | |
# copied from http://blog.udzura.jp/2010/03/08/petit-hacking-about-const_get/ | |
def self.nested_const_get(name) | |
stack = (name.is_a?(Array)) ? name : name.to_s.split("::") | |
klass = Object | |
while const = stack.shift | |
klass = klass.const_get(const) | |
end |
... .htaccess | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_FILENAME} -f | |
RewriteRule ^(.*\.html)$ file.php?target=$1 [QSA,L] | |
#敢えてファイルが存在するときで、末尾に.htmlが付くファイルの場合のみリライトさせる | |
</IfModule> | |
# A simple app that implements a naive session-based login, to demonstrate the problems with testing sessions in Sinatra. | |
require 'rubygems' | |
require 'sinatra/base' | |
class LoginApp < Sinatra::Base | |
enable :sessions | |
get '/' do |