我想在Linux和Windows中设置sprocket。在我的database.yml中,如何?
现在:
development:
adapter: mysql2
encoding: utf8
database: skeletor_dev
pool: 25
username: root
password:
socket: /private/var/mysql/mysql.sock
我想要类似的东西:
development:
adapter: mysql2
encoding: utf8
database: skeletor_dev
pool: 25
username: root
password:
socket: /private/var/mysql/mysql.sock if os => windows
socket: /private/var/mysql/mysql.sock if os => linux
有可能吗?怎么样?
答案 0 :(得分:0)
使用ERB。
development:
socket: <%= %w[windows linux].include?(ruby_code_to_get_os) ? '/path/to/sock' : nil %>
显然,您必须弄清楚如何最好地确定平台本身,但这应该让您前进。