s21gブログをRails-2.2.2に移行する作業をしてる所なのですが、 erubis-2.6.2を使っていると、テスト時に以下のようなエラーが発生しました。 pre>> /opt/local/lib/ruby/gems/1.8/gems/erubis-2.6.2/lib/erubis/enhancer.rb:666:in `gsub!': can't modify frozen string (TypeError) <<-- erubisのソースを見てみると、 **lib/erubis/enhancer.rbL666** ruby>> def _add_text_to_str(str, text) return if !text || text.empty? text.gsub!(/['\#\\]/, '\\\\\&') str << text end <<-- となっていたので、これをひとまず以下のように直してみました(呼び出しもとをざっと見た感じだと、textを破壊的に変更しなくしても挙動に影響は無さそうだった)。 ruby>> def _add_text_to_str(str, text) return if !text || text.empty? text = text.gsub(/['\#\\]/, '\\\\\&') str << text end <<-- これで先ほどのエラーは出なくなったのですが、 今度は別なエラーが。 pre>> ActionView::TemplateError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.<< On line #13 of app/views/users/edit.html.erb 10:
11:

Account

12: <% 13: form_for(:user, @user, 14: :url => user_path(@user), :html => {:method => :put}) do |f| 15: %> 16: <%= hidden_field_tag :from, :edit %> /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/text_helper.rb:42:in `concat' /opt/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/action_view/helpers/form_helper.rb:252:in `form_for' <<-- form_forの中のconcatでエラーが出ている模様。こちらもソースを見てみると、 **actionpack-2.2.2/lib/action_view/helpers/text_helper.rb** ruby>> def concat(string, unused_binding = nil) if unused_binding ActiveSupport::Deprecation.warn("The binding argument of #concat is no longer needed. Please remove it from your views and helpers.", caller) end output_buffer << string end <<-- output_bufferがnilになってるって事みたいです。 Railsでerubisを使っている方、情報求む! **See Also** * [Using Erubis 2.6.2 with Rails 2.2.2 is incompatible?](http://stackoverflow.com/questions/389178/using-erubis-262-with-rails-222-is-incompatible) * [Rails 2.0.1 と 2.0.2 で ERB まわりがけっこう変更されてた](http://d.hatena.ne.jp/kwatch/20080501/1209657073)
posted by genki genki on Thu 25 Dec 2008 at 17:45 with 0 comments
Contents rssrss
光ファイバーを二次元振動させて走査するAR用ディスプレイ
因果の取り違え
Swift2's defer for CoffeeScript
mongodb-3.0からcreateIndexのdropDupsが無くなったらしい
mongodb-3.0以降のWiredTigerの設定を動的に変更する方法
一般楕円の高速生成アルゴリズムへの道標
farro mantecatoのレシピ
Droonga関連の記事のまとめ
RuntimeErrorの特定のメッセージに限定してrescueする方法
jQueryでscriptタグを実行せずにappendする
Tags
coffeescriptdefergroongajsmemonodenodejs
Comments rssrss
https://listji.com/index.php?page=user&action=pub_profile&id=72479&item_type=active&per_page=16 https://listji.com/index.php?page=user&action=pub_profile&id=72479&item_type=active&per_page=16: As tһe premier furniture store аnd comprehensive f... 05/16 07:16
https://khvanchkaravino.ru https://khvanchkaravino.ru: Квартира мечты за 2 месяца — помогаем выбрать мебе... 05/16 05:06
https://www.tequilagames.com https://www.tequilagames.com: Thanks for finally writing about >something new an... 05/16 03:16
https://%EB%B6%80%EB%B9%84%EC%A3%BC%EC%86%8C.isweb.co.kr/ https://%EB%B6%80%EB%B9%84%EC%A3%BC%EC%86%8C.isweb.co.kr/: We absolutely love your blog and find a lot of you... 05/16 01:40
https://zgarcitul01.com https://zgarcitul01.com: Hi my loved one! I wish to say that this post is a... 05/16 01:10
https://pelnadobrego.pl https://pelnadobrego.pl: I love what you guys tend to be up too. This sort ... 05/15 22:11
https://bet365info.org/%f0%9f%92%b8-%d8%a8%d8%a7-%d9%87%db%8c%da%86%db%8c-%d8%af%d8%b1-%d8%a7%d9%86%d9%81%d8%ac%d8%a7%d8%b1-%d9%85%db%8c%d9%84%db%8c%d9%88%d9%86%d8%b1-%d8%b4%d9%88-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c/ https://bet365info.org/%f0%9f%92%b8-%d8%a8%d8%a7-%d9%87%db%8c%da%86%db%8c-%d8%af%d8%b1-%d8%a7%d9%86%d9%81%d8%ac%d8%a7%d8%b1-%d9%85%db%8c%d9%84%db%8c%d9%88%d9%86%d8%b1-%d8%b4%d9%88-%d8%b1%d8%a7%d9%87%d9%86%d9%85%d8%a7%db%8c/: درود، بنده امروز اتفاقی در اینترنت با این وبسایت آ... 05/15 21:26
https://linklist.bio/jutawanbetlogin https://linklist.bio/jutawanbetlogin: Hi there, You've done an excellent job. I will ce... 05/15 21:20