Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 472

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 487

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 494

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-settings.php on line 530

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/cache.php on line 103

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-includes/theme.php on line 623

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/custom_posts/custom_posts.php on line 22

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 46

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 67

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 75

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/pukiwiki.php on line 92

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiRender.php on line 70

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 181

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 538

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 695

Deprecated: Assigning the return value of new by reference is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/modPukiWiki/class/PukiWikiElement.php on line 1087

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112

Deprecated: Function ereg() is deprecated in /home/users/1/fool.jp-ichi/web/blog/wp-content/plugins/wp-ban/wp-ban.php on line 112
rails3 + jqueryで DELETEやらPOSTのリンクががが。 | おれせか
おれせか

なんかそれっぽいのをうにうに。

rails3いじいじ中。

<%= link_to 'ログアウト', user_session_path(@current_user), :method => :delete %>

みたいなリンククリックすると『No Route matches』言われちゃう。

サーバーログのほうには、

Started GET "/user_sessions/1" for 127.0.0.1 at 2011-02-17 14:32:19 +0900

ActionController::RoutingError (No route matches "/user_sessions/1"):

みたく出てて、DELETEでもPOSTでもなくGETになっておられる、と。

あるぇー?ってことで色々試してみたけどよーわからん。
というわけで@:masarakkiに相談してみたら、「DELETEとかのリンク処理してるjsおかしいんじゃね?」ということに。

おお。jsといえば、思い当たるフシがあるよ! と。

3分でRails3+rspec+jquery+mysql開発環境を準備する - どっかのBlogの前置きのような

ここにあるようにrails3+jqueryでつくりはじめたんだけど

rails g jquery:install

でエラーでちゃってた。

      remove  public/javascripts/controls.js
      remove  public/javascripts/dragdrop.js
      remove  public/javascripts/effects.js
      remove  public/javascripts/prototype.js
    fetching  jQuery (1.5)
   identical  public/javascripts/jquery.js
   identical  public/javascripts/jquery.min.js
    fetching  jQuery UJS adapter (github HEAD)
/Users/ichi/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:677: [BUG] Segmentation fault
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10.6.0]

-- control frame ----------
c:0040 p:---- s:0195 b:0195 l:000194 d:000194 CFUNC  :connect
c:0039 p:0440 s:0192 b:0192 l:000608 d:000608 METHOD /Users/ichi/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:677
c:0038 p:0011 s:0185 b:0185 l:000184 d:000184 METHOD /Users/ichi/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:637
c:0037 p:0048 s:0182 b:0182 l:000181 d:000181 METHOD /Users/ichi/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/net/http.rb:626
c:0036 p:0646 s:0179 b:0179 l:000178 d:000178 METHOD /Users/ichi/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/open-uri.rb:306

〜以下略〜

前述のブログにはキニシナイ!て書いてたから気にせずそのままいじってたんだけど、どうも本来ならあるはずのrails.jsとか入ってない状態のままになってたらしい。

というわけで教えてぐぐる先生した結果

https://github.com/rails/jquery-ujs
ここのREADMEの『Manual installation』にあるようにrails.jsをつっこんで、config/application.rbに

config.action_view.javascript_expansions[:defaults] = %w(jquery rails)

てしたら、イケタ!!

ちなみに

相談した@:masarakkiによると、これmac特有の問題じゃなイカ? とのこと。
rubyのMLでちょうど同じような報告があったらしい。

フェー。

とりあえず、@:masarakki△としておこう。

PAGETOP
PAGETOP

Prev / Next in same category

PAGETOP

Comments (17)

本文中の以下のリンク先がおかしい?
https://github.com/rails/jquery-ujs

[2011/09/10 (土) 21:40]

ほんとだ!
修正しました!

[2011/09/30 (金) 15:57]

safariんとこはreturn trueだな。
明日なおす。

[2012/12/20 (木) 16:47]

Aw, this was a really good post. Taking a few minutes and actual effort to create a really good article

[2013/05/21 (火) 12:28]

Wow this is a great post. This contain have many useful information. Please post more information to share with us.

[2013/10/11 (金) 18:33]

This is a great share!

[2014/04/15 (火) 18:05]

thank you for your blog. It is very good.

[2014/07/18 (金) 12:03]

ほんとはまとめて変換しないでちゃんと対象ファイルしっかり選んで変換したほうがきっといいよ!

[2015/09/16 (水) 13:04]

Safe Xanax Migraine Xanax Vs Valium . Xanax Soda And Xanax Combination Oxycontin Oxycodone Lavender Upjohn Xanax Buy Xanax Online Online Consultation Roche Xanax Xanax Addiction Less Drug_side_effects . Xanax Shipped 2 Day Xanax Family Herbal Xanax Bargain Prescription order alprazolam online without prescription. Zanny Childcare Xanax All About The Pill Xanax Xanax Dosage Dogs Separation Anxiety Lariam Xanax .

[2015/10/10 (土) 20:59]

I like the helpful info you provide in your articles. I’ll bookmark your weblog and check again here regularly. I’m quite sure I’ll learn lots of new stuff right here! Best of luck for the next!

[2015/11/09 (月) 12:43]

赤くて緑の色合わせシャネル激安は自動的に鎖の腕時計に行って1人似通って見聞、
サンタクロースに富を極めて、
シャネル激安http://www.cctoh.com/

最も敬虔な祝福を使って祝いの贈り物をします楽しいクリスマスの時間。
シャネル眼鏡
シャネル腕時計
シャネルピアス
シャネル財布
シャネル靴
シャネルバッグ
シリーズの腕時計は皆賭博の世界の濃厚な息を含んで、
シャネルの時計の文字盤設計の格調をまねるのが鮮明で、
モナコ観光名所の蒙特ka羅の独特な個性を反映します。

[2015/11/19 (木) 00:12]

良い書き込み記事をありがとう!それは実際にはアミューズメントアカウントです。

[2015/11/23 (月) 17:46]

capタスクに追加された。
これで「cap deploy:seed」でdeploy先で「rake db:seed」できる(はず)。

[2016/01/06 (水) 17:50]

Aw, this was a really good post. Taking a few minutes and actual effort to

[2016/01/07 (木) 10:57]

宝のスーパーコピーめでたい(ミュウミュウ)。

[2016/01/15 (金) 17:43]

↑の記事を読んで、おおこりゃいいやと思いつつ使ってみた時に気づいたことメモ。

[2016/03/31 (木) 10:00]
PAGETOP

Comment Form

PAGETOP

Trackbacks (1)

[...] ここをみて解決 rails3 + jqueryで DELETEやらPOSTのリンクががが。 https://github.com/rails/jquery-ujs ここのREADMEの『Manual installation』にあるようにrails.jsをつっこんで、config/application.rbに [...]

PAGETOP

Trackback URL

PAGETOP

Search