好きこそ 物ノ上手ナレ

What one likes, one will do well.

span~をcol-xs-~に変えるだけの簡単なお仕事。

bootstrap2から3に変える話。

Railsチュートリアルでテキストフィールドとかボタンとかいっぱいになってしまうパターン。

理想はこれ。

第10章 ユーザーのマイクロポスト | Rails チュートリアル

結構違うので、修正したほうがよさそだと感じたのでなおした。

f:id:pirori67:20150302192354p:plain

 

話は簡単で、

span8とか書いてるところを、col-xs-8みたいに

span~をcol-xs-~に変えるだけ。

作業後は、こんな感じ。

f:id:pirori67:20150302192936p:plain

 

以上!

 

<参考>


bootstrap 2.3.2 から bootstrap 3.1.1 への移行 - @znz blog

Failure/Error: specify { expect(response).to redirect_to(signin_path) }

Railsチュートリアルにて。

Rspecのエラーが通らない、
NoMethodErrorで次のような内容。

Authentication authorization for non-signed-in users in the Users controller submitting to the update action Failure/Error: specify { expect(response).to redirect_to(signin_path) } NoMethodError:

 

rspecのバージョンアップで解決します。

gem "rspec-rails", '~> 2.14.0.rc1'
を書いて
$ bundle update

 

追記
GemfileにRubygems.orgから新しいgemだとうまくいかなかった。
gem 'rspec-rails', '~> 3.2.0'
gem 'capybara', '~> 2.4.4'

$ bundle update

テストが大量に失敗・・・
っていう感じで、泥沼だったので。以上。

 

参考
http://stackoverflow.com/questions/24801396/michael-hartl-chapter9-authorization-error

Bootstrap3で@extend.control-group; (Railsチュートリアルより)

Bootstrap2から3に変えた影響で、エラーが出た。

f:id:pirori67:20150224214131p:plainエラーを回避するにはapp/assets/stylesheets/custom.css.scss:を変更する。
.field_with_errors{
@extend.control-group;
@extend.error;
}

.field_with_errors{
@extend.has-error;
}
に変更すれば、
こんな感じになる。

f:id:pirori67:20150224214405p:plain

@extend.has-error;1つで済むとちょっとすっきり。

あとは、エラーの雰囲気が違うので、ついでになおす。

エラーの雰囲気がチュートリアルと若干違うので、
App/views/shared/_error_messages.html.erbの内容を修正。

<divclass="alertalert-error">
の内容を以下に書き換え。

<div class="alert alert-danger">

f:id:pirori67:20150224214701p:plain

bootstrap2と3って、少し違うみたい。

 

<参考>
http://stackoverflow.com/questions/19917429/ruby-field-with-errors-doesnt-extend-control-group-error

ruby-2.1.1 is not installed. To install do: 'rvm install ruby-2.1.1' が出るようになったら。

rvmで以前まで使ってたバージョンを削除したら、

こんなメッセージ出たパターン

 

(例:2.1.1使ってて消した時)

ruby-2.1.1 is not installed.

To install do: 'rvm install ruby-2.1.1'

 

railsプロジェクトにある、

.ruby-version というファイル中に変更したバージョンを書けばいい。

 

ターミナルでディレクトリ移動した時にいらっとするし、

.ruby-versionのファイルを忘れそうなので、メモ代わりに。