Recent Posts by Scott Gardner
|
May 9, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Updating the Image link to add_to_cart for AJAX (pg 130) Replying to my own topic to report a problem with degrading this functionality when JS is turned off (pg 138). As it stands, using the code I posted above, clicking on the image with JS off does nothing. Why is that? It’s calling the same action, so the request.xhr? conditional should work the same as clicking the Add to Cart button, right? I tried refactoring the link as follows, which I got to work but the display got fouled up and my initial attempts to fix the CSS didn’t work (e.g., display: inline;, wrapping it in a new div class, etc.). Is this the correct approach (and thus I just need to fix my CSS), or is there a better way? |
|
May 9, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Updating the Image link to add_to_cart for AJAX (pg 130) The end of lesson assignments previously had us make the image a link to add_to_cart. Once you switch over to using an Ajax cart, your link will no longer work. Here’s my code to update that link: depot/app/views/store/index.html.erb
|
|
May 9, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Trying to understand a code example (pg 110, cart.rb) That really helped, thanks! |
|
May 9, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Trying to understand a code example (pg 110, cart.rb) Thanks for the detailed explanation. I am really just trying to put a handle on this because I realize it’s a key and common usage in Ruby/Rails. I think, for now, I will just have to rely on rote memory of how this works. Also, can you confirm/correct your statement that this block is in fact an object? According to this explanation on rubylearning.com, a block is not an object unless it is converted to a Proc (e.g., using lambda). |
|
May 8, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Trying to understand a code example (pg 110, cart.rb) The following section of code (excerpted from page 110 depot_g/app/models/cart.rb line 2 in the book, but I’ve included relevant setup code) has_thrown_me_for :a => :loop…
Here’s how I understand it: Can someone please confirm that I have this correct? Presuming yes, I still do not understand how the block, which resolves true or false, knows to return the actual item object when a true condition occurs. Thanks! |
|
May 6, 2008
Scott Gardner
6 posts
|
Topic: Agile Web Development with Rails, 3rd Edition / Chapter 3: Installing Rails - Keep it! In the Note to beta book readers, you mention the possibility of completely removing this chapter, and ask for our feedback. Mine is: update it and keep it! This is valuable info for those of us needing to install or update our Ruby or Rails. Thanks |
6 posts
