Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery not working at delete action on Michael Hartl's tutorial, chapter 11
    primarykey
    data
    text
    <p>I'm working on rails tutorial by Michael Hartl like other newbies in rails do. anyway, I'm stuck at the chapter 11 like those too with some JQuery not working with delete action issue. That's to say, when clicking on any delete button, it only redirects me to a particular error page saying "No route matches [GET] "/microposts/301"</p> <p>My code in the _micropost.html.erb page is as below:</p> <pre><code>&lt;tr&gt; &lt;td class="micropost"&gt; &lt;span class="content"&gt;&lt;%= micropost.content %&gt;&lt;/span&gt; &lt;span class="timestamp"&gt; Posted &lt;%= time_ago_in_words(micropost.created_at) %&gt; ago. &lt;/span&gt; &lt;/td&gt; &lt;% if current_user?(micropost.user) %&gt; &lt;td&gt; &lt;%= link_to "delete", micropost, :method =&gt; :delete, :confirm =&gt; "You sure?", :title =&gt; micropost.content %&gt; &lt;/td&gt; &lt;% end %&gt; &lt;/tr&gt; </code></pre> <p>So, I checked with my gem file whether it had prototype and jQuery conflict or not. what I found is as below</p> <pre><code>source 'http://rubygems.org' gem 'rails', '3.1.1' gem 'annotate', :git =&gt; 'git://github.com/ctran/annotate_models.git' # Bundle edge Rails instead: # gem 'rails', :git =&gt; 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'gravatar_image_tag', '1.0.0.pre2' gem 'will_paginate', '3.0.pre2' # Gems used only for assets and not required # in production environments by default. group :assets do #gem 'sass-rails', '~&gt; 3.1.4' gem 'coffee-rails', '~&gt; 3.1.1' gem 'uglifier', '&gt;= 1.0.3' end gem 'jquery-rails' group :development do gem 'rspec-rails', '2.6.1' gem 'faker', '0.3.1' end group :test do gem 'rspec-rails', '2.6.1' gem 'webrat', '0.7.1' gem 'factory_girl_rails', '1.0' end group :production do gem 'therubyracer-heroku', '~&gt; 0.8.1.pre3', :platform =&gt; :ruby #gem 'therubyracer-heroku', '0.8.1.pre3' # you will need this too gem 'pg' end </code></pre> <p>So, I am quite so sure here there is no prototype installed, as I heard for the rails 3.1 onward the jQuery is used by default.</p> <p>Any advice that you think to get it working for me? Where to check that my jQuery is already installed properly.</p> <p>As per @Tuck's suggestion, I post my routes.rb here.</p> <pre><code>SampleApp::Application.routes.draw do resources :users resources :sessions, :only =&gt; [:new, :create, :destroy] resources :microposts, :only =&gt; [:create, :destroy] match '/signup', :to =&gt; 'users#new' match '/signin', :to =&gt; 'sessions#new' match '/signout', :to =&gt; 'sessions#destroy' match '/contact', :to =&gt; 'pages#contact' match '/about', :to =&gt; 'pages#about' match '/help', :to =&gt; 'pages#help' root :to =&gt; 'pages#home' get "pages/home" get "pages/contact" get "pages/about" end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload