Rails 3 提供了 match
方法供我们自定义 routes,然而我们要小心使用它以避免“跨站脚本攻击”(XSS Attack)。比如像这样的 routes:
注:(r3 代表 Rails 3,r4 代表 Rails 4)
# routes.rb
:+1: | |
:-1: | |
:airplane: | |
:art: | |
:bear: | |
:beer: | |
:bike: | |
:bomb: | |
:book: | |
:bulb: |
html-pipeline: 把 text formatting 做成一層一層的 filter 接成 pipeline
linguist: 自動偵測一段文本或檔案的程式語言, GitHub 本身用它來偵測你專案使用的程式語言
charlock_holmes: 自動偵測文本的文字編碼,來自一個叫做 ICU 的資料庫,不知道是什麼,搜集了一堆文字編碼資訊和地區格式。
github-markdown: 實際在 GitHub 使用的 markdown compiler ,我找不到公開的 repo ,但程式碼是 MIT license ,很神秘…
github-markup: 用來把 README.md 這種檔案給 render 成 HTML
html-pipeline: 把 text formatting 做成一層一層的 filter 接成 pipeline
linguist: 自動偵測一段文本或檔案的程式語言, GitHub 本身用它來偵測你專案使用的程式語言
charlock_holmes: 自動偵測文本的文字編碼,來自一個叫做 ICU 的資料庫,不知道是什麼,搜集了一堆文字編碼資訊和地區格式。
github-markdown: 實際在 GitHub 使用的 markdown compiler ,我找不到公開的 repo ,但程式碼是 MIT license ,很神秘…
github-markup: 用來把 README.md 這種檔案給 render 成 HTML
# Path to your oh-my-zsh configuration. | |
ZSH=$HOME/.oh-my-zsh | |
# Set name of the theme to load. | |
# Look in ~/.oh-my-zsh/themes/ | |
# Optionally, if you set this to "random", it'll load a random theme each | |
# time that oh-my-zsh is loaded. | |
#ZSH_THEME="yaci" | |
ZSH_THEME="yaci-agnoster" |
This is how we test that all translation keys match up between locales.
Stuff that only goes in one locale (such as an admin section) or that can't be translated yet (if you use external translators) can simply go in files that don't match the path "config/locales/??.yml", like "config/locales/wip.fo.yml".
require 'active_record' | |
ActiveRecord::Base.establish_connection adapter: "sqlite3", database: ":memory:" | |
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Schema.define do | |
create_table :users do |t| | |
t.timestamps | |
end | |
create_table :activities do |t| | |
t.integer :user_id |