0

I'm working with ROR 4. I posted this question about how my link_to wouldn't POST correctly using { method: :post }.

I figured out this was because I removed the Rails-Jquery gem when I first set up my app (this is a side project, I hadn't planned on using Javascript/jQuery or so I thought!).

In an effort to get my POST working, I added the gem back to Gemfile. The file now looks like this:

    source 'https://rubygems.org'

    gem 'aws-sdk'
    gem 'faker'
    gem 'jquery-rails'
    gem 'inline_svg'
    gem 'jbuilder', '~> 2.0'
    gem 'nokogiri'
    gem 'paperclip'
    gem 'pg'
    gem 'rails', '~> 4.2.0'
    gem 'sass-rails'

I did a bundle install.

I added the below code to application.js:

    //= require jquery
    //= require jquery_ujs
    //= require_tree .

What am I missing? jQuery still isn't loading in the Network tab in Chrome.

I'm guessing I must have changed another config setting on setup (5 weeks ago) that I am now forgetting.

UPDATE: I also removed turbolinks during the main setup. Is that needed for jQuery to work?

Community
  • 1
  • 1
Kelly
  • 619
  • 8
  • 18

1 Answers1

1

If you removed javascript during the initial setup, you are probably missing this from the head of your application.html.erb layout.

<%= javascript_include_tag 'application' %>
JeffD23
  • 8,318
  • 2
  • 32
  • 41