[Rails4]引入bootstrap3卻找不到icons

事由:

以前在Rails4 使用bootstrap2.3 沒有這樣問題,升級到bootstrap3.2 卻發生照官方文件引入icons卻無法順利顯示,只顯示方塊。

解決方法:

跑去bootstrap-sass的github查看了一下文件,引入以下原始碼就完成!

$subl app/assets/stylesheets/application.css.scss

@import "bootstrap-sprockets";
@import "bootstrap";

備註:
application.css記得改成application.css.scss不然還是無法顯示icon

不過網站從bootstrap2.3升級到bootstrap3.2,幾乎整個網站都得重寫過,改變很大!


參考網址:

https://github.com/twbs/bootstrap-sass

[Rilas4] 從rvm轉到rbenv的過程

環境:

Ubuntu 14.04

操作過程:

1. 刪除RVM

rvm implode
其他注意事項:

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc and ~/.rvm if they exist still.
Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.
Also make sure to remove ‘rvm’ group if this was a system installation.
Finally it might help to relogin / restart if you want to have fresh environment (like for installing RVM again).

2. 簡單兩步驟安裝rbenv

First you install rbenv, and then ruby-build

$ cd ~
$ git clone git://github.com/sstephenson/rbenv.git .rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ exec $SHELL

$ git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
$ exec $SHELL

$ rbenv install 2.1.2
$ rbenv global 2.1.2
$ ruby -v

3. 參考網址:

Setup Ruby On Rails on Ubuntu 14.04 Trusty Tahr
move from rvm to rbenv

[rails4]RVM移除與安裝

說明:

之前裝RVM沒有裝好,導致gem套件在安裝時都必須要加上sudo才有辦法繼續安裝。

原本不以為意,頂多安裝套件時加一下sudo就可以了。當然事情沒有這麼簡單就解決,gem有沒有加sudo安裝位置是不一樣,導致一些從網路上clone下來的程式bundle install會出現一些我無法解決的問題。

剛好今晚突然心血來潮,索性來研究一下如何安裝gem不用加上sudo

閱讀全文〈[rails4]RVM移除與安裝〉

[rails4]使用Omniauth整合facebook及google註冊認證

最近將進行中的Ruby on rails專案嘗試加上oauth 2.0註冊認證,再整合目前最多人使用的facebook及google帳號,讓來客能便利的註冊會員。

簡單記錄下這次的操作記錄,還有不少待改進處。

####安裝流程
1. 創建一個新專案
2. 安裝所需要的gem
3. 創建User model
4. 創建Sessions controller
5. 創建及設定Omniauth initializer
6. 加入facebook javascript
7. 修改views增加登入及登出選項

閱讀全文〈[rails4]使用Omniauth整合facebook及google註冊認證〉