Rails3.1系からRails3.2に移行する

Sysprep+Ghostをやりながらなのでめちゃくちゃになるかも。

Aptana - SVNリポジトリ>右クリックの新規-リポジトリー・ロケーション「URL」
リポジトリからフォルダー選択>右クリック「チェックアウト」
cd \C:\workspace\hoge
>gem update rails -v 3.2.17
>bundle update rails
>rake rails:update
すべてn

createするとこんなのが出た

ActiveModel::MassAssignmentSecurity::Error (Can't mass-assign protected attribut
es: name, memo):

モデルにホワイトリストを書いてあげるらしい

class Hoge < < ActiveRecord::Base
  attr_accessible :name, :memo

これは別の回避方法があったらしい。

# application.rb
    config.active_record.whitelist_attributes = false

リストボックスが困ったことになった。

https://gist.github.com/fxn/1648523
Generate hidden input before select with :multiple option set to true. This is useful when you rely on the fact that when no options is set, the state of select will be sent to rails application. Without hidden field nothing is sent according to HTML spec *Bogdan Gusiev*

Why is the first element always blank in my Rails multi-select, using an embedded array?
困っている人多数いる。

空白を入れたがる対策はこんなのをapplication_controller.rbに入れる。

  def delete_blank(arrs)
    arrs = arrs.delete_if{ |x| x.empty? }
  end

before_filterが厳密になった

before_filter :sidemenu, :only=>[:edit, :new]

createを入れ忘れていたらエラーになるようになった


Ruby on Rails入門者におすすめしたい便利なメソッド7つ【サンプル付き】
Rails2系 => Rails3.0系移行、実践的まとめ