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://businessrost.ru/bitrix/redirect.php?goto=http%3A%2F%2Feximha.ch%2Fblog%2Findex.php%3Fid%3Dz85yj914%26abuse%3D1636 https://businessrost.ru/bitrix/redirect.php?goto=http%3A%2F%2Feximha.ch%2Fblog%2Findex.php%3Fid%3Dz85yj914%26abuse%3D1636: I have to thank you for the efforts you have put ... 04/26 06:43
http://ldm.sakura.ne.jp/balu+bbbs/album/album.cgi?mode=detail&no=210 http://ldm.sakura.ne.jp/balu+bbbs/album/album.cgi?mode=detail&no=210: Aw, this was an incredibly good post. Taking the t... 04/25 18:19
https://www.bigbeargum.com/2019/02/15/ambrose-redmoon/ https://www.bigbeargum.com/2019/02/15/ambrose-redmoon/: Hello would you mind letting me know which hosting... 04/25 17:39
http://zeroken.jp/1978td/album/album.cgi?mode=detail&no=20 http://zeroken.jp/1978td/album/album.cgi?mode=detail&no=20: Asking questions are genuinely fastidious thing if... 04/25 17:26
https://natucci-estetica.com/?attachment_id=1376 https://natucci-estetica.com/?attachment_id=1376: Hello there, You have done a fantastic job. I wi... 04/25 17:05
https://www.waimaoz.com/23019.html?unapproved=5151&moderation-hash=a14b2a811444fc3059edb7c1441d076e https://www.waimaoz.com/23019.html?unapproved=5151&moderation-hash=a14b2a811444fc3059edb7c1441d076e: Good day! Do you use Twitter? I'd like to follow y... 04/25 16:50
https://bysystem.ru/process-proizvodstva-kartonnyh-korobok-i/ https://bysystem.ru/process-proizvodstva-kartonnyh-korobok-i/: Требовалось производство картонных коробок в сжа... 04/25 15:33
https://marialionsa.ru/proizvodstvo-kartonnyh-korobok-i-upakovki/ https://marialionsa.ru/proizvodstvo-kartonnyh-korobok-i-upakovki/: Документооборот четкий, все закрывающие акты предо... 04/25 15:05