2013年9月29日 星期日
[ROR] Turbolink, ajax, jQuery, coffeescript, Asset Pipeline
緣由:
想在ROR 4上面寫ajax
我先依照的教學寫了一下,
http://ihower.tw/rails3/assets-and-ajax.html
不過他是for ROR 3.x
所以惡夢就開始了...
2013年9月22日 星期日
[ROR] heroku change postgress
如果要清掉heroku上面的DB
好像沒辦法用 rake db:drop
我是直接用它的web介面刪掉db
在建立一個新的
不過
使用 git push heroku時
db帳號密碼就會不對
我後來找到
heroku config
可以看到
DATABASE_URL: xxxxx
HEROKU_POSTGRESQL_AQUA_URL: yyyyyy
就用
heroku config:set DATABASE_URL=yyyyyy
換成正確的postgres db的位置就好了
2013年9月21日 星期六
[ROR] heroku, postgres,
有在嘗試的 Paas
原本在試驗openshift ,不過在上傳啟動server的部份遇到的困難,我就轉去heroku看看
基本上我照著他的教學跑了一次
有遇到幾個問題
1. 網頁上app 的名稱
似乎給了一串預設的編碼
如果改了
就要記得執行
git config -e
把裡面的 git remote的位置改變
2. postgres
他們官方是建議使用postgres
我也在local端裝了
不過如過在 development 下 使用 postgres
會導致我必需把local 的username 給傳到git 上面
有點不想.... 實驗了很久,如果再mac 上在開一個使用者
好像還是有權限的問題
最後....我想說在development下用 sqlite就好了
Gemfile 寫下
# Use postgresql as the database for Active Record
group :production, :test do
gem 'pg'
end
group :development do
gem 'sqlite3'
end
然後
database.yml 就用
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
==================
ROR 能做的設定參考:http://ihower.tw/rails3/environments-and-bundler.html
http://robdodson.me/blog/2012/04/27/how-to-setup-postgresql-for-rails-and-heroku/
http://www.fullybaked.co.uk/articles/getting-postgresql-running-on-osx-mountain-lion
http://www.moncefbelyamani.com/how-to-install-postgresql-on-a-mac-with-homebrew-and-lunchy/