5: <= image_tag(product.image_url) >
6:
|
17 May 2008, 21:14
Sam Ruby (549 posts) |
I’ll try to explore further tomorrow, but to get past that specific problem, modify app/controllers/login_controller.rb thus: def index @products = Product.find(:all) @total_orders = Order.count end |
|
17 May 2008, 04:21
Casey Smith (5 posts) |
Thanks Sam I will check that. Is there a place just to get problems answers that I come across? |
|
17 May 2008, 02:11
Sam Ruby (549 posts) |
(from Agile Web Development with Rails (2nd edition) > Problem with ITERATION A4: PRETTIER LISTINGS (Rails 2.0.2 beta book))
You are doing it right, the image isn’t in sync. Removing the “h” from the truncate line may help, but that depends on tags not being arbitrarily chopped. A better approach, and one that I am considering for future betss is something like the following: <%=h truncate(product.description.gsub(/<.*?>/,''),80) %> |
|
17 May 2008, 02:04
Sam Ruby (549 posts) |
Um, you are ahead of me. Check the preface to the third edition for what chapters are ready. Either that, or look for the visual clues in the form of the colors of the top and bottom borders on each page. |
|
17 May 2008, 01:01
Joseph Van Overberghe (2 posts) |
(from Agile Web Development with Rails (2nd edition) > Problem with ITERATION A4: PRETTIER LISTINGS (Rails 2.0.2 beta book))
Getting the following… !http://img221.imageshack.us/img221/7563/listing…! The html tags are in the database as
|
|
16 May 2008, 23:37
Casey Smith (5 posts) |
I get an error when I run http://localhost:3000/login/login I get this error message=
Showing login/index.html.erb where line #3 raised: You have a nil object when you didn’t expect it! Extracted source (around line #3): 1: Your Pragmatic Catalog2: 3: <% for product in @products -> 4: 5: <= image_tag(product.image_url) > 6: <= h(product.title) %> |
|
16 May 2008, 21:33
Jamie Paulson (3 posts) |
Thanks for the response, Sam…but I think the book text is actually correct (it actually states that we can just use “cart” w/o the ”@”)...this is purely user error. Working out of a PDF book apparently presents my brain some challenges in being able to read carefully. :-) |
|
16 May 2008, 18:15
Christophe Porteneuve (63 posts) |
Hey Abbas, Well, I’m not going to guide you through a complete UI control creation, this is not what these forums are for, and I lack the time. BUT, the product browser you’re linking to is, indeed, based on Prototype and script.aculo.us (through the Control.Slider class), with a couple nice UI touches on it, such as putting category labels on top of the handle image, and dissociating the actual handle (invisible) and the image to let the “visible” one slide around when you click. You can get inspiration on how to replicate this cool widget by looking at its source code (it’s in http://www.apple.com/global/scripts/product_bro…), but be sure to avoid just copy-pasting it: the code belongs to Apple. At any rate, it probably relies on data structures not quite fit for your own purposes. You’ll probably need to dive into the Sliders chapter around the end of the book before, though. ‘HTH |
|
16 May 2008, 14:46
Fabrice Touzain (1 post) |
Hello, I had the same error message. Fabrice |
|
16 May 2008, 14:23
James Hogue (5 posts) |
Sam, I upgraded mysql from 4.0 to 5.0 and it worked, but I had to edit /etc/my.cnf to add the INNODB stuff, so I am wondering if maybe that would have done it for 4.0 as well. I would check for you, but I nuked 4.0 completely before installing 5.0, so going back is not really an option. Someone else may want to check this out. Thanks for your help! |