AWDWR question

I’ve been working my way through AWDWR (beta pdf), and have gotten
through
to page 137.

Just to be sure I’m not “chasing the wrong dog”, I thought I’d post and
see if others have come across the same situation.

The code appears to be working fine to this point with the following
exception:

When any of the “Add to cart” buttons are selected the AJAX section of
the
page (the left side displaying the cart contents and totals) does not
update (redisplay).

I know the information has been recorded because when I manually refresh
the page, the contents of the cart are updated.

From what I read, it seems as though the rails app should be redisplaying
this section of the page each time an item is added to the cart.

My browser is Mozilla Firefox 1.5.0.5. I know the browser supports AJAX
requests, and I get the same results when using IE 6.0.2900.2180, which
also supports AJAX (in the Windose way).

Have others had the same experience or where should I look to resolve
this
issue? OR Have I misunderstood how this application is supposed to work?

TIA for any and all responses.

– Steve

On Aug 9, 2006, at 5:11, [email protected] wrote:

The code appears to be working fine to this point with the following
exception:

When any of the “Add to cart” buttons are selected the AJAX section
of the
page (the left side displaying the cart contents and totals) does not
update (redisplay).

Have you included the javascript libraries in the store layout?

Does the code that’s downloadable from the book’s site work OK for you?

Regards

Dave

Steve,

Re-start your web-server ( webbrick/mongrel ) and try again. It worked
for me.

Thanks,
VS.

unknown wrote:

I’ve been working my way through AWDWR (beta pdf), and have gotten
through
to page 137.

Just to be sure I’m not “chasing the wrong dog”, I thought I’d post and
see if others have come across the same situation.

The code appears to be working fine to this point with the following
exception:

When any of the “Add to cart” buttons are selected the AJAX section of
the
page (the left side displaying the cart contents and totals) does not
update (redisplay).

I know the information has been recorded because when I manually refresh
the page, the contents of the cart are updated.

From what I read, it seems as though the rails app should be redisplaying
this section of the page each time an item is added to the cart.

My browser is Mozilla Firefox 1.5.0.5. I know the browser supports AJAX
requests, and I get the same results when using IE 6.0.2900.2180, which
also supports AJAX (in the Windose way).

Have others had the same experience or where should I look to resolve
this
issue? OR Have I misunderstood how this application is supposed to work?

TIA for any and all responses.

– Steve

Please send text only mails. It increases the chances that more people
will be
able to understand your problem and help you.

Steve D. [email protected] writes:

face="Helvetica" size="3">The code appears to be working fine to this selected the AJAX section of the


Regards

something related to "edge rails" and AJAX? I
code to work, as it will be a crucial part of my next project.
Steve D.

Rails mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

On Aug 10, 2006, at 12:02, Steve D. wrote:

You can get to my version of the application at: http://
24.23.248.71:3000/store/

Yes, it fails here too, which means it isn’t a browser issue.

You next step is to download the source code for the book and run it.
Then find out how it differs form yours.

Regards

Dave T.

On Aug 14, 2006, at 8:40 PM, Cesar Ho wrote:

I just came across this same issue, I am working with Edge rails
and debugged it down to the “==”.
Try replacing:
cart_item == @current_item with
with:
cart_item.equal?(@current_item)

I believe that == may have been overwritten.

Whoa! I hope not. Let me dg into this the next time I have the
chapter opened up.

Dave

I downloaded the code and was able to run it successfully without
replacing
the “==” with “equal?” so it may have to do with some gem/engine I may
have
installed. It’s strange “==” and “equal” should be synonymous, and it
works
on a single product but not when multiple products are added to the same
cart.

I’ll try to reproduce the bug with something else.

Cesar

I just came across this same issue, I am working with Edge rails and
debugged it down to the “==”.
Try replacing:
cart_item == @current_item with
with:
cart_item.equal?(@current_item)

I believe that == may have been overwritten.

Cesar

I found it! :smiley: Silly mistake should have done a diff on the file instead
of
the class contents! For the CartItem model, I used the generate model
script
which made it inherit the ActiveRecord class. Removing ActiveRecord
fixes
the problem.

ActiveRecord obviously redefines “==”, I guess the most obvious mistakes
are
the hardest to find.

Cesar