Topic: Ruby on Rails Tutorial by Michael Hartl, Exercise 5.5

Hi everyone,

I purchased Michael's excellent book and am really enjoying it. I however found his questions on 5.5 to be somewhat confusing. I didn't find any relevant material in the chapter that explains how to save an IMG tag as a variable in the views helper. I am wondering if anyone has gone through this and has a solution to exercise 5.5.?

Or any hints from that chapter that might lead me to finding the answer! Thanks everyone. smile

Re: Ruby on Rails Tutorial by Michael Hartl, Exercise 5.5

That is a great tutorial.  The screencasts are even better.  I'd say a couple things:

(1) There is a forum specifically for the tutorial at: http://getsatisfaction.com/railstutorial

(2) Check section 5.21.  You can see he is defining the variable "logo" in the html like so:

<% logo = image_tag("logo.png", :alt => "Sample App", :class => "round") %>
  <%= link_to logo, root_path %>

Good Luck
@thatdankent

I'm so abstract that automatic doors at grocery stores do not even open for me. - @thatdankent

Re: Ruby on Rails Tutorial by Michael Hartl, Exercise 5.5

Thanks Starflyer. I didn't even realize they had a forum! I just posted here because you guys are always so helpful! That said I see the code you posted. The helper however is a ruby file so it won't be able to create the logo object in the same way, at least I don't think. I'll forward my question to the forum!

Re: Ruby on Rails Tutorial by Michael Hartl, Exercise 5.5

I was confusing myself and not paying attention to local and instance variables.

Originally I placed
@logo = image_tag("logo.png") #inside the application helper file

My application.html.erb didn't know what logo was, but did know what @logo was.

This is a silly mistake on my part as I taught myself ruby prior to learning rails. Thanks again Starflyer!