Hello all,
Sorry for flooding the list with silly questions lately, but I’m having
some difficulty with some basic concepts in Rails.
- What is the difference between an item prefixed with a colon and one
without (as in :class => “test” vs class => test). I think there’s a
major concept I’m missing out on here, as this problem nails me
frequently.
- How in the world do I make an image link? I know how to do it in
HTML, but how the heck do I nest calls to helpers? In this case I’d be
using the <%= image_tag … %> inside of a <%link_to…%>. How do I do
this?
Thanks,
Will
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.
An item prefixed with a colon is a symbol. It’s sort of like a string.
“class” => “test”, :class => “test”, etc. Without a colon prefixed, it
would
be a variable.
<%= link_to image_tag(“image.jpg”), :controller => ‘main’, :action =>
‘index’ %>
just like,
<%= link_to “Text”, :controller => ‘main’, :action => ‘index’ %>
Just replace the text that you want to link to with your image_tag.
You might want to read a few basic texts on Ruby before starting out.
Why’s
guide is a good intro (and fun), or the first edition of the Pickaxe is
also
available online, and it provides a good enough “textbookish” coverage.
Vish
Cool. Thanks man. Do you have a link for the pickaxe book?
Vishnu G. [email protected] wrote: An item prefixed with a colon
is a symbol. It’s sort of like a string. “class” => “test”, :class =>
“test”, etc. Without a colon prefixed, it would be a variable.
<%= link_to image_tag(" image.jpg"), :controller => ‘main’, :action =>
‘index’ %>
just like,
<%= link_to “Text”, :controller => ‘main’, :action => ‘index’ %>
Just replace the text that you want to link to with your image_tag.
You might want to read a few basic texts on Ruby before starting out.
Why’s guide is a good intro (and fun), or the first edition of the
Pickaxe is also available online, and it provides a good enough
“textbookish” coverage.
Vish
On 9/25/06, Will G. [email protected] wrote: Hello all,
Sorry for flooding the list with silly questions lately, but I’m having
some difficulty with some basic concepts in Rails.
- What is the difference between an item prefixed with a colon and one
without (as in :class => “test” vs class => test). I think there’s a
major concept I’m missing out on here, as this problem nails me
frequently.
- How in the world do I make an image link? I know how to do it in
HTML, but how the heck do I nest calls to helpers? In this case I’d be
using the <%= image_tag … %> inside of a <%link_to…%>. How do I do
this?
Thanks,
Will
Yahoo! Messenger with Voice. Make PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.
(What is best in life?) To crush your enemies, see them driven before
you, and to hear the lamentations of the women. - Conan the Barbarian
All-new Yahoo! Mail - Fire up a more powerful email and get things done
faster.
On 9/24/06, Will G. [email protected] wrote:
Cool. Thanks man. Do you have a link for the pickaxe book?
http://www.rubycentral.com/book/