作者kira925 (蓝色飞舞之剑)
看板Ruby
标题[心得] RoR + Postgresql template修正
时间Wed Nov 9 13:17:13 2011
这是我在依照 ihower 版友的 RoR 实战圣经练习的时候遇到的问题
在产生 demo 成功,接下来要撰写自己的 Hello World 时
会遇到一些问题:
Postgresql 跳出来抱怨!
1. role "<username>" does not exist
在 Linux 下要切换成 postgres 这个 ID:
$ su - postgres
然後建立新使用者:
$ createuser <username>
2. new encoding (UTF8) is incompatible with the encoding of the
template database (SQL_ASCII)
RoR预设是用 UTF8 作为编码,但是 Postgresql 的预设居然是... SQL_ASCII
google以後有个暂时解:
在 database.yml 里面加上一行:
development:
adapter: postgresql
encoding unicode
database: demo_development
"template : template0"
Postgresql 有另外一个 template 用的是 UTF8 当预设encoding
不过这样每次都要修改,有板友有更好的办法吗?
--
ψDeathDeath
这是我的钢弹 这是我的意志 啊干 有什麽武器可以用
┌────┐
我最了解它! 我非去不可! 别死啊 ......
┌─(0w0 )┐ ┌───┐┌────┐ ┌───┐┌────┐
┌─ V) )┐
不准去 => ╞ ( ) │ (0wξ )│ => ╞ ("0w0) │ (-wξ )│
┌─ < │┐
你会死的! │ (﹀Υ﹀Υ ㄏへ )│ │ (﹀Υ﹀Υ ㄏへ )│
┌───│┐ \(wQ ) │| ̄ ̄ ̄ ̄ ̄|───┘ │| ̄ ̄ ̄ ̄ ̄|───┘
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.113.28.197