[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

why is this a comile error

bimo remus

1/13/2006 9:14:00 PM

I am doing a tutorial from the Thomas~Hansson book and am getting this
error:

Extracted source (around line #17):

14: <%= link_to 'Add to Cart',
15: {:action => 'add_to_cart',
16: :id => product },
17: class => 'addtocart' %>
18: </br>
19: </td>
20: </tr>

Trace of template inclusion: /app/views/store/index.rhtml

I've compared what I have with the book and they seem the same. I'm
thinking that either I'm missing something (very possible) or maybe the
error is actually being generated somewhere else but I'm very green (a
newbie)...

Does anyone have any ideas?

b

--
Posted via http://www.ruby-....


18 Answers

Austin Ziegler

1/13/2006 9:17:00 PM

0

On 13/01/06, bimo remus <bmoremus@yahoo.com> wrote:
> I am doing a tutorial from the Thomas~Hansson book and am getting this
> error:
>
> Extracted source (around line #17):
>
> 14: <%= link_to 'Add to Cart',
> 15: {:action => 'add_to_cart',
> 16: :id => product },
> 17: class => 'addtocart' %>
> 18: </br>
> 19: </td>
> 20: </tr>
>
> Trace of template inclusion: /app/views/store/index.rhtml
>
> I've compared what I have with the book and they seem the same. I'm
> thinking that either I'm missing something (very possible) or maybe the
> error is actually being generated somewhere else but I'm very green (a
> newbie)...

This is better posted to the Rails list:

http://lists.rubyonrails.org/mailman/list...

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


James Gray

1/13/2006 9:20:00 PM

0

On Jan 13, 2006, at 3:14 PM, bimo remus wrote:

> I am doing a tutorial from the Thomas~Hansson book and am getting this
> error:
>
> Extracted source (around line #17):
>
> 14: <%= link_to 'Add to Cart',
> 15: {:action => 'add_to_cart',
> 16: :id => product },
> 17: class => 'addtocart' %>
> 18: </br>
> 19: </td>
> 20: </tr>

You are missing one character from the book. On the last line it's
":class", not "class". The latter is a reserved word in Ruby with
special meaning, thus the problem.

Hope that helps.

James Edward Gray II


James Gray

1/13/2006 9:25:00 PM

0

On Jan 13, 2006, at 3:17 PM, Austin Ziegler wrote:

> On 13/01/06, bimo remus <bmoremus@yahoo.com> wrote:
>> I am doing a tutorial from the Thomas~Hansson book and am getting
>> this
>> error:
>>
>> Extracted source (around line #17):
>>
>> 14: <%= link_to 'Add to Cart',
>> 15: {:action => 'add_to_cart',
>> 16: :id => product },
>> 17: class => 'addtocart' %>
>> 18: </br>
>> 19: </td>
>> 20: </tr>
>>
>> Trace of template inclusion: /app/views/store/index.rhtml
>>
>> I've compared what I have with the book and they seem the same. I'm
>> thinking that either I'm missing something (very possible) or
>> maybe the
>> error is actually being generated somewhere else but I'm very
>> green (a
>> newbie)...
>
> This is better posted to the Rails list:
>
> http://lists.rubyonrails.org/mailman/list...

Is it, this time?

I know this has become our standard response, but the issue above is
a Ruby syntax mistake. It has nothing to do with Rails. Is that not
squarely in our area of expertise here?

I'm not trying to be argumentative. I'm honestly trying to
understand when we should forward them and when we should not.

James Edward Gray II



Jonathan Leighton

1/13/2006 9:35:00 PM

0

On Sat, 2006-01-14 at 06:20 +0900, James Edward Gray II wrote:
> On Jan 13, 2006, at 3:14 PM, bimo remus wrote:
>
> > I am doing a tutorial from the Thomas~Hansson book and am getting this
> > error:
> >
> > Extracted source (around line #17):
> >
> > 14: <%= link_to 'Add to Cart',
> > 15: {:action => 'add_to_cart',
> > 16: :id => product },
> > 17: class => 'addtocart' %>
> > 18: </br>
> > 19: </td>
> > 20: </tr>
>
> You are missing one character from the book. On the last line it's
> ":class", not "class". The latter is a reserved word in Ruby with
> special meaning, thus the problem.

By the way, you will be doing yourself a service to get a text editor
that includes syntax highlighting for Ruby and rhtml. Little mistakes
like this will be much easier to spot.

I know jEdit, Textmate and RadRails all support rhtml highlighting.

Jon

--
Jonathan Leighton
http://turnips... | http://jonathanlei... | http://digital-...



Caleb Tennis

1/13/2006 9:40:00 PM

0


> You are missing one character from the book. On the last line it's
> ":class", not "class". The latter is a reserved word in Ruby with
> special meaning, thus the problem.

As well as the closing brace after 'addtocart'

Caleb


James Gray

1/13/2006 9:44:00 PM

0

On Jan 13, 2006, at 3:39 PM, Caleb Tennis wrote:

>
>> You are missing one character from the book. On the last line it's
>> ":class", not "class". The latter is a reserved word in Ruby with
>> special meaning, thus the problem.
>
> As well as the closing brace after 'addtocart'

No, I don't think so. Here's the call again:

> <%= link_to 'Add to Cart', {:action => 'add_to_cart', :id =>
> product }, class => 'addtocart' %>

Don't let that second Hash argument throw you.

James Edward Gray II



David Vallner

1/13/2006 10:08:00 PM

0

On Fri, 13 Jan 2006 22:35:27 +0100, Jonathan Leighton
<lists@turnipspatch.com> wrote:

> On Sat, 2006-01-14 at 06:20 +0900, James Edward Gray II wrote:
>
> By the way, you will be doing yourself a service to get a text editor
> that includes syntax highlighting for Ruby and rhtml. Little mistakes
> like this will be much easier to spot.
>
> I know jEdit, Textmate and RadRails all support rhtml highlighting.
>
> Jon
>


Speaking of which, I'll have to get a multimode.el for XEmacs somewhere.
Making rhtml-mode shouldn't bee too difficult.

David Vallner


Caleb Tennis

1/13/2006 10:14:00 PM

0


>
> Don't let that second Hash argument throw you.
>
>

It did! Oh well, it's Friday.

Caleb


Austin Ziegler

1/13/2006 11:00:00 PM

0

On 13/01/06, James Edward Gray II <james@grayproductions.net> wrote:
> On Jan 13, 2006, at 3:17 PM, Austin Ziegler wrote:
> > This is better posted to the Rails list:
> > http://lists.rubyonrails.org/mailman/list...
> Is it, this time?
>
> I know this has become our standard response, but the issue above is
> a Ruby syntax mistake. It has nothing to do with Rails. Is that not
> squarely in our area of expertise here?

Yes, it's a Ruby syntax mistake. However, it's *not* code that's
runnable without Rails.

-austin
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca


Jonathan Leighton

1/13/2006 11:21:00 PM

0

On Sat, 2006-01-14 at 07:14 +0900, Caleb Tennis wrote:
> > Don't let that second Hash argument throw you.
>
> It did! Oh well, it's Friday.

Not only is it Friday, but it's the thirteenth ;)

--
Jonathan Leighton
http://turnips... | http://jonathanlei... | http://digital-...