17 May 2008, 21:14
Samr_small_pragsmall

Sam Ruby (549 posts)

(from Agile Web Development with Rails (3rd edition) > Iteration F2)

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
Generic-user-small

Casey Smith (5 posts)

(from Agile Web Development with Rails (3rd edition) > Iteration F2)

Thanks Sam I will check that. Is there a place just to get problems answers that I come across?

17 May 2008, 02:11
Samr_small_pragsmall

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
Samr_small_pragsmall

Sam Ruby (549 posts)

(from Agile Web Development with Rails (3rd edition) > Iteration F2)

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
Generic-user-small

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 <p> and <em> but when they are used in the code (snippet) below the are converted to &lt;p&gt; and &lt;em&gt; when viewed on the page source. So instead of being HTML tags the actual text is shown as above. What am I doing wrong? I am using XP, MYSQL5, ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32], and Rails 2.0.2.


<table cellpadding="5" cellspacing="0">
<% for product in @products %>
<tr valign="top" class="<%= cycle('list-line-odd', 'list-line-even') %>">
<td>
<img class="list-image" src="<%= product.image_url %>"/>
</td>
<td width="60%">
<span class="list-title"><%=h product.title %></span><br />
<%=h truncate(product.description,80) %>
</td>
....

16 May 2008, 23:37
Generic-user-small

Casey Smith (5 posts)

(from Agile Web Development with Rails (3rd edition) > Iteration F2)

I get an error when I run http://localhost:3000/login/login I get this error message=

NoMethodError in Login#index

Showing login/index.html.erb where line #3 raised:

You have a nil object when you didn’t expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.each

Extracted source (around line #3):

1:

Your Pragmatic Catalog


2:
3: <% for product in @products ->
4:

5: <= image_tag(product.image_url) >
6:

<= h(product.title) %>

16 May 2008, 21:33
Generic-user-small

Jamie Paulson (3 posts)

(from Agile Web Development with Rails (3rd edition) > Depot Iteration D1 issues)

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
Avatar_mw_large_pragsmall

Christophe Porteneuve (63 posts)

(from Prototype and script.aculo.us > Slider and drop down lists)

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
Generic-user-small

Fabrice Touzain (1 post)

(from Agile Web Development with Rails (2nd edition) > form.select undefined method)

Hello,

I had the same error message.
This was only a typo error in 00?_create_orders.rb migration file for the database (I typed pya_type instead of pay_type).
(see at AWDwRoR 2nd Ed. on page 131 (printed version) for more details about this migration file)
I hope you did the same.

Fabrice

16 May 2008, 14:23
Generic-user-small

James Hogue (5 posts)

(from Agile Web Development with Rails (3rd edition) > depot application with mysql)

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!