Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9171231
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T16:08:05+00:00 2026-06-17T16:08:05+00:00

Having a very odd problem. I am following the Agile Web Development with Rails

  • 0

Having a very odd problem. I am following the Agile Web Development with Rails (2nd edition) and am currently on the Ajax request iteration.

The Problem: My Application isn’t making an AJAX request instead just redirecting to the store_path.

My Line Items create actions looks as follows:

  def create
    @cart = current_cart
    product = Product.find(params[:product_id])
    @line_item = @cart.add_product(product.id)

    respond_to do |format|
      if @line_item.save
        format.html { redirect_to(store_url) }
        format.js
        format.xml  { render :xml => @line_item,
          :status => :created, :location => @line_item }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @line_item.errors,
          :status => :unprocessable_entity }
      end
    end
  end

And the add to cart looks like this:

  <%= button_to 'Add to Cart', line_items_path(:product_id => product),remote: true %>

Producing the following form:

<form action="/line_items?product_id=3" class="button_to" data-remote="true" method="post"><div><input type="submit" value="Add to Cart"><input name="authenticity_token" type="hidden" value="euZKvTy2ioSTITELTb06ErJZfSeGBuzoMhUyHROvgjI="></div></form>

I have also placed the create.js.rjs in view/line_items directory with the following content:

page.replace_html('cart', render(@cart))

EDIT: SERVER LOG
Hmm…seems like there is an error in the <%= javascript_include_tag :defaults %>

Started GET "/" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Processing by StoreController#index as HTML
  Product Load (0.2ms)  SELECT "products".* FROM "products" ORDER BY title
  Cart Load (0.1ms)  SELECT "carts".* FROM "carts" WHERE "carts"."id" = ? LIMIT 1  [["id", 22]]
  Rendered store/index.html.erb within layouts/application (7.6ms)
  LineItem Load (0.3ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."cart_id" = 22
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = 3 ORDER BY title LIMIT 1
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = 4 ORDER BY title LIMIT 1
  Rendered line_items/_line_item.html.erb (6.7ms)
  Rendered carts/_cart.html.erb (12.4ms)
Completed 200 OK in 34ms (Views: 29.2ms | ActiveRecord: 1.1ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/depot.css?body=1" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /depot.css - 304 Not Modified (0ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/defaults.js" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /defaults.js - 404 Not Found (6ms)

ActionController::RoutingError (No route matches [GET] "/assets/defaults.js"):
  actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.9) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.9) lib/rails/engine.rb:479:in `call'
  railties (3.2.9) lib/rails/application.rb:223:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.9) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'


  Rendered /var/lib/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (1.1ms)


Started GET "/assets/logo.png" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /logo.png - 304 Not Modified (2ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/ruby.jpg" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /ruby.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/rtp.jpg" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /rtp.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/wd4d.jpg" for 127.0.0.1 at 2013-01-23 17:43:05 -0800
Served asset /wd4d.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:05] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started POST "/line_items?product_id=3" for 127.0.0.1 at 2013-01-23 17:43:35 -0800
Processing by LineItemsController#create as HTML
  Parameters: {"authenticity_token"=>"euZKvTy2ioSTITELTb06ErJZfSeGBuzoMhUyHROvgjI=", "product_id"=>"3"}
  Cart Load (0.1ms)  SELECT "carts".* FROM "carts" WHERE "carts"."id" = ? LIMIT 1  [["id", 22]]
  Product Load (0.1ms)  SELECT "products".* FROM "products" WHERE "products"."id" = ? ORDER BY title LIMIT 1  [["id", "3"]]
  LineItem Load (0.1ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."cart_id" = 22 AND "line_items"."product_id" = 3 LIMIT 1
   (0.1ms)  begin transaction
   (0.2ms)  UPDATE "line_items" SET "quantity" = 28, "updated_at" = '2013-01-24 01:43:35.930200' WHERE "line_items"."id" = 56
   (158.5ms)  commit transaction
Redirected to http://0.0.0.0:3000/
Completed 302 Found in 168ms (ActiveRecord: 159.1ms)


Started GET "/" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Processing by StoreController#index as HTML
  Product Load (0.3ms)  SELECT "products".* FROM "products" ORDER BY title
  Cart Load (0.1ms)  SELECT "carts".* FROM "carts" WHERE "carts"."id" = ? LIMIT 1  [["id", 22]]
  Rendered store/index.html.erb within layouts/application (6.1ms)
  LineItem Load (0.2ms)  SELECT "line_items".* FROM "line_items" WHERE "line_items"."cart_id" = 22
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = 3 ORDER BY title LIMIT 1
  Product Load (0.2ms)  SELECT "products".* FROM "products" WHERE "products"."id" = 4 ORDER BY title LIMIT 1
  Rendered line_items/_line_item.html.erb (4.7ms)
  Rendered carts/_cart.html.erb (8.8ms)
Completed 200 OK in 28ms (Views: 23.5ms | ActiveRecord: 1.0ms)


Started GET "/assets/depot.css?body=1" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /depot.css - 304 Not Modified (0ms)
[2013-01-23 17:43:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/defaults.js" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /defaults.js - 404 Not Found (4ms)

ActionController::RoutingError (No route matches [GET] "/assets/defaults.js"):
  actionpack (3.2.9) lib/action_dispatch/middleware/debug_exceptions.rb:21:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.9) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.9) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.9) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.9) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.9) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.9) lib/rails/engine.rb:479:in `call'
  railties (3.2.9) lib/rails/application.rb:223:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.9) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /usr/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /usr/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'


  Rendered /var/lib/gems/1.9.1/gems/actionpack-3.2.9/lib/action_dispatch/middleware/templates/rescues/routing_error.erb within rescues/layout (0.7ms)


Started GET "/assets/ruby.jpg" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /ruby.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/logo.png" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /logo.png - 304 Not Modified (0ms)
[2013-01-23 17:43:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/wd4d.jpg" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /wd4d.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true


Started GET "/assets/rtp.jpg" for 127.0.0.1 at 2013-01-23 17:43:36 -0800
Served asset /rtp.jpg - 304 Not Modified (0ms)
[2013-01-23 17:43:36] WARN  Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T16:08:05+00:00Added an answer on June 17, 2026 at 4:08 pm

    Well I found the error. I failed to read the error message. The problem was indeed that the javascript libraries weren’t being loaded. For anyone looking for a solution the problem is that javascript_include_tag :all looks for javascript files in the /public/javascript folder. To include the necessary javascript file use javascript_include_tag :application which will include the application.js under /app/assets/javascript/application.js.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently having this really odd problem with my layout IE7. I'm not very experienced
Im having a very odd problem. Im trying to install a Python program. Im
I'm having a very odd problem with my program and am hoping you can
I am having a very odd problem with Visual Studio 2010. After using it
I'm having a very odd problem in C# and I'm not sure what is
I'm having a very odd problem with grouping a set of nodes in a
I am having a very odd error occurring in the following: class ServeHandler(blobstore_handlers.BlobstoreDownloadHandler): def
I'm having a really odd problem that seems very unrelated. I'm trying to use
I seem to be having a very odd problem with my iPhone project in
I´m having a very odd problem I´m building a mobile app in HTML5 using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.