新手问题 关于 Rails 的数据库配置文件 database.yml 当中,Yaml 的表达式解释的问题,查阅了一些资料还是没有了解

kakaxi2 · October 04, 2015 · Last by lb563 replied at October 06, 2015 · 2184 hits
# SQLite version 3.x
#   gem install sqlite3
#
#   Ensure the SQLite 3 gem is defined in your Gemfile
#   gem 'sqlite3'
#
default: &default
  adapter: sqlite3
  pool: 5
  timeout: 5000

development:
  <<: *default
  database: db/development.sqlite3

# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
  <<: *default
  database: db/test.sqlite3

production:
  <<: *default
  database: db/production.sqlite3 

其中&default定义了引动点,*defalut进行了引用,不明白的地方在于符号<<:的作用是什么?

http://www.yaml.org/refcard.html

'<<' : Merge keys from another mapping.

#2 楼 @kakaxi2 把引用点的配置合并到你引用“<<“的地方

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