Agile web Development with Rails section 9.3

Discussion in 'Ruby' started by Angel Dinar, May 19, 2010.

  1. Angel Dinar

    Angel Dinar Guest

    Hello
    I am reading Agile Web Development with rails (third addition).
    And I need some help with it.
    I have reached chapter 9.3

    when I press on the add to cart button I get an error message.
    a real ugly one.

    eventually, I downloaded the PDF version and copied the content of the
    files but it did not help.

    I have looked but could not find the problem.
    Please give me a hand.
    Thanks
    Angel



    try {
    Element.update("cart", "\n\n<div class=\"cart-title\">Your
    Cart</div>\n<table>\n \n\n\n<!-- START_HIGHLIGHT -->\n\n <tr
    id=\"current_item\"> \n\n<!-- #END_HIGHLIGHT -->\n\n\n\n\n<tr>\n
    <td>7&times;</td>\n <td>Pragmatic Project Automation</td>\n <td
    class=\"item-price\">$209.65</td>\n</tr>\n\n\n <tr
    class=\"total-line\">\n <td colspan=\"2\">Total</td>\n <td
    class=\"total-cell\">$209.65</td>\n </tr>\n\n</table>\n\n<form
    method=\"post\" action=\"/store/empty_cart\"
    class=\"button-to\"><div><input type=\"submit\" value=\"Empty cart\"
    /><input name=\"authenticity_token\" type=\"hidden\"
    value=\"6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\"
    /></div></form>\n");
    $("current_item").visualEffect("highlight",
    {"endcolor":"#114411","startcolor":"#88ff88"});
    } catch (e) { alert('RJS error:\n\n' + e.toString());
    alert('Element.update(\"cart\", \"\\n\\n<div
    class=\\\"cart-title\\\">Your Cart</div>\\n<table>\\n \\n\\n\\n<!--
    START_HIGHLIGHT -->\\n\\n <tr id=\\\"current_item\\\"> \\n\\n<!--
    #END_HIGHLIGHT -->\\n\\n\\n\\n\\n<tr>\\n <td>7&times;</td>\\n
    <td>Pragmatic Project Automation</td>\\n <td
    class=\\\"item-price\\\">$209.65</td>\\n</tr>\\n\\n\\n <tr
    class=\\\"total-line\\\">\\n <td colspan=\\\"2\\\">Total</td>\\n
    <td class=\\\"total-cell\\\">$209.65</td>\\n
    </tr>\\n\\n</table>\\n\\n<form method=\\\"post\\\"
    action=\\\"/store/empty_cart\\\" class=\\\"button-to\\\"><div><input
    type=\\\"submit\\\" value=\\\"Empty cart\\\" /><input
    name=\\\"authenticity_token\\\" type=\\\"hidden\\\"
    value=\\\"6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\\\"
    /></div></form>\\n\");\n$(\"current_item\").visualEffect(\"highlight\",
    {\"endcolor\":\"#114411\",\"startcolor\":\"#88ff88\"});'); throw e }
    --
    Posted via http://www.ruby-forum.com/.
     
    Angel Dinar, May 19, 2010
    #1
    1. Advertising

  2. Angel Dinar

    Josh Cheek Guest

    [Note: parts of this message were removed to make it a legal post.]

    On Wed, May 19, 2010 at 12:02 PM, Angel Dinar <> wrote:

    > Hello
    > I am reading Agile Web Development with rails (third addition).
    > And I need some help with it.
    > I have reached chapter 9.3
    >
    > when I press on the add to cart button I get an error message.
    > a real ugly one.
    >
    > eventually, I downloaded the PDF version and copied the content of the
    > files but it did not help.
    >
    > I have looked but could not find the problem.
    > Please give me a hand.
    > Thanks
    > Angel
    >
    >
    >
    > try {
    > Element.update("cart", "\n\n<div class=\"cart-title\">Your
    > Cart</div>\n<table>\n \n\n\n<!-- START_HIGHLIGHT -->\n\n <tr
    > id=\"current_item\"> \n\n<!-- #END_HIGHLIGHT -->\n\n\n\n\n<tr>\n
    > <td>7&times;</td>\n <td>Pragmatic Project Automation</td>\n <td
    > class=\"item-price\">$209.65</td>\n</tr>\n\n\n <tr
    > class=\"total-line\">\n <td colspan=\"2\">Total</td>\n <td
    > class=\"total-cell\">$209.65</td>\n </tr>\n\n</table>\n\n<form
    > method=\"post\" action=\"/store/empty_cart\"
    > class=\"button-to\"><div><input type=\"submit\" value=\"Empty cart\"
    > /><input name=\"authenticity_token\" type=\"hidden\"
    > value=\"6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\"
    > /></div></form>\n");
    > $("current_item").visualEffect("highlight",
    > {"endcolor":"#114411","startcolor":"#88ff88"});
    > } catch (e) { alert('RJS error:\n\n' + e.toString());
    > alert('Element.update(\"cart\", \"\\n\\n<div
    > class=\\\"cart-title\\\">Your Cart</div>\\n<table>\\n \\n\\n\\n<!--
    > START_HIGHLIGHT -->\\n\\n <tr id=\\\"current_item\\\"> \\n\\n<!--
    > #END_HIGHLIGHT -->\\n\\n\\n\\n\\n<tr>\\n <td>7&times;</td>\\n
    > <td>Pragmatic Project Automation</td>\\n <td
    > class=\\\"item-price\\\">$209.65</td>\\n</tr>\\n\\n\\n <tr
    > class=\\\"total-line\\\">\\n <td colspan=\\\"2\\\">Total</td>\\n
    > <td class=\\\"total-cell\\\">$209.65</td>\\n
    > </tr>\\n\\n</table>\\n\\n<form method=\\\"post\\\"
    > action=\\\"/store/empty_cart\\\" class=\\\"button-to\\\"><div><input
    > type=\\\"submit\\\" value=\\\"Empty cart\\\" /><input
    > name=\\\"authenticity_token\\\" type=\\\"hidden\\\"
    > value=\\\"6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\\\"
    > /></div></form>\\n\");\n$(\"current_item\").visualEffect(\"highlight\",
    > {\"endcolor\":\"#114411\",\"startcolor\":\"#88ff88\"});'); throw e }
    > --
    > Posted via http://www.ruby-forum.com/.
    >
    >


    Hi, this is a Ruby mailing list (the language Rails was written in), not a
    Rails mailing list. You should try a Rails list, you will get much better
    help. Especially considering the code you posted looks like JavaScript, not
    Ruby.

    A few things, though:

    1. If you are certain you've done everything correctly, you might check the
    errata to see if something in the book isn't right:
    http://www.pragprog.com/titles/rails3/errata

    2. You said "when I press on the add to cart button I get an error message.
    a real ugly one." but you haven't given any information about the error
    message. These exist to let you know something is wrong, and where it went
    wrong so that you know where to go start troubleshooting. This would be good
    information to include, it gives people (and you) an idea where it went
    wrong.
     
    Josh Cheek, May 19, 2010
    #2
    1. Advertising

  3. Angel Dinar

    Angel Dinar Guest

    Thank you for replying.

    the application is written in Ruby.
    the error message is something I do not understand.
    the link to my files is at:

    Download link: http://rapidshare.com/files/389266124/chapter-9.tar.gz

    http://localhost:3000/store

    I am certain that I did something wrong, I just can't seem to find
    what...
    the ugly message I got is the code I attached in my first message.

    Thanks for your help



    Josh Cheek wrote:
    > On Wed, May 19, 2010 at 12:02 PM, Angel Dinar <>
    > wrote:
    >
    >>
    >> id=\"current_item\"> \n\n<!-- #END_HIGHLIGHT -->\n\n\n\n\n<tr>\n
    >> {"endcolor":"#114411","startcolor":"#88ff88"});
    >> action=\\\"/store/empty_cart\\\" class=\\\"button-to\\\"><div><input
    >> type=\\\"submit\\\" value=\\\"Empty cart\\\" /><input
    >> name=\\\"authenticity_token\\\" type=\\\"hidden\\\"
    >> value=\\\"6ZdrTVjPgu0Lls4YyuTXbg1an5X/KKNZJKgDfruU6Qo=\\\"
    >> /></div></form>\\n\");\n$(\"current_item\").visualEffect(\"highlight\",
    >> {\"endcolor\":\"#114411\",\"startcolor\":\"#88ff88\"});'); throw e }
    >> --
    >> Posted via http://www.ruby-forum.com/.
    >>
    >>

    >
    > Hi, this is a Ruby mailing list (the language Rails was written in), not
    > a
    > Rails mailing list. You should try a Rails list, you will get much
    > better
    > help. Especially considering the code you posted looks like JavaScript,
    > not
    > Ruby.
    >
    > A few things, though:
    >
    > 1. If you are certain you've done everything correctly, you might check
    > the
    > errata to see if something in the book isn't right:
    > http://www.pragprog.com/titles/rails3/errata
    >
    > 2. You said "when I press on the add to cart button I get an error
    > message.
    > a real ugly one." but you haven't given any information about the error
    > message. These exist to let you know something is wrong, and where it
    > went
    > wrong so that you know where to go start troubleshooting. This would be
    > good
    > information to include, it gives people (and you) an idea where it went
    > wrong.


    --
    Posted via http://www.ruby-forum.com/.
     
    Angel Dinar, May 19, 2010
    #3
  4. Angel Dinar

    Angel Dinar Guest

    Angel Dinar, May 19, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stephen Kellett

    Book: Agile Web Development with Rails

    Stephen Kellett, Jun 13, 2005, in forum: Ruby
    Replies:
    4
    Views:
    124
    Ara.T.Howard
    Jun 14, 2005
  2. Replies:
    10
    Views:
    209
    Jeffrey Dik
    Nov 7, 2005
  3. basi
    Replies:
    4
    Views:
    107
  4. Dave Thomas
    Replies:
    10
    Views:
    186
    Gene Tani
    Oct 22, 2006
  5. Dave Thomas
    Replies:
    0
    Views:
    98
    Dave Thomas
    Apr 23, 2008
Loading...

Share This Page