Forum: Ruby why is this a comile error

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bd197d8ce0d9fa1a174a13ae108fa2db?d=identicon&s=25 Bimo Remus (bimo)
on 2006-01-13 22:14
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
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-01-13 22:18
(Received via mailing list)
On 13/01/06, bimo remus <bmoremus@yahoo.com> wrote:
> 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/listinfo/rails

-austin
Bd197d8ce0d9fa1a174a13ae108fa2db?d=identicon&s=25 Bimo Remus (bimo)
on 2006-01-13 22:21
thanks
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-01-13 22:21
(Received via mailing list)
On Jan 13, 2006, at 3:14 PM, bimo remus wrote:

> 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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-01-13 22:27
(Received via mailing list)
On Jan 13, 2006, at 3:17 PM, Austin Ziegler wrote:

>> 17:                             class => 'addtocart' %>
>> green (a
>> newbie)...
>
> This is better posted to the Rails list:
>
> http://lists.rubyonrails.org/mailman/listinfo/rails

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
9d4ec8946f933a18a1d15b094cc3c425?d=identicon&s=25 Jonathan Leighton (Guest)
on 2006-01-13 22:36
(Received via mailing list)
On Sat, 2006-01-14 at 06:20 +0900, James Edward Gray II wrote:
> > 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
9c7f2f44463d1d4890f73e8a8229dd29?d=identicon&s=25 Caleb Tennis (Guest)
on 2006-01-13 22:42
(Received via mailing list)
> 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
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-01-13 22:45
(Received via mailing list)
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
430ea1cba106cc65b7687d66e9df4f06?d=identicon&s=25 David Vallner (Guest)
on 2006-01-13 23:10
(Received via mailing list)
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
9c7f2f44463d1d4890f73e8a8229dd29?d=identicon&s=25 Caleb Tennis (Guest)
on 2006-01-13 23:16
(Received via mailing list)
>
> Don't let that second Hash argument throw you.
>
>

It did!  Oh well, it's Friday.

Caleb
31ab75f7ddda241830659630746cdd3a?d=identicon&s=25 Austin Ziegler (Guest)
on 2006-01-14 00:01
(Received via mailing list)
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/listinfo/rails
> 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
9d4ec8946f933a18a1d15b094cc3c425?d=identicon&s=25 Jonathan Leighton (Guest)
on 2006-01-14 00:22
(Received via mailing list)
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 ;)
4299e35bacef054df40583da2d51edea?d=identicon&s=25 James Gray (bbazzarrakk)
on 2006-01-14 01:01
(Received via mailing list)
On Jan 13, 2006, at 4:59 PM, Austin Ziegler wrote:

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

I see a lot of code posted here that requires external libraries and
we fix that.  Is there a reason Rails is different?

James Edward Gray II
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-01-14 01:13
(Received via mailing list)
On 1/13/06, James Edward Gray II <james@grayproductions.net> wrote:
> >> squarely in our area of expertise here?
> >
> > Yes, it's a Ruby syntax mistake. However, it's *not* code that's
> > runnable without Rails.
>
> I see a lot of code posted here that requires external libraries and
> we fix that.  Is there a reason Rails is different?

I'd say that it's the fact that Rails already has a large support
community that we should point them in that direction.  A lot of
libraries aren't as easily supported, as if the developers may not get
to the questions in a timely fashion, etc etc.

I think though it seems a bit harsh, sending people to the Rails
mailing list actually does a service, rather than a disservice.  If
they did not know it existed before, they find a great new resource,
otherwise, they just know where to ask next time.

Though, I usually try to offer whatever help I can with a question,
THEN point people to the rails list, just to be nice ;)
0817571d150afead454f4220007042fe?d=identicon&s=25 Matthew Desmarais (Guest)
on 2006-01-14 01:23
(Received via mailing list)
Gregory Brown wrote:
>>>>> http://lists.rubyonrails.org/mailman/listinfo/rails
>> I see a lot of code posted here that requires external libraries and
> they did not know it existed before, they find a great new resource,
> otherwise, they just know where to ask next time.
>
> Though, I usually try to offer whatever help I can with a question,
> THEN point people to the rails list, just to be nice ;)
>
Once again, GBrown beats me to it.  I agree.

If a person wants to use Rails to build their web app and they aren't
interested in the Ruby that Rails is built in, I'm comfortable with
that.  Referring them to the Rails list where they can talk Rails
without having to filter out all of the noise about that "Ruby" thing is
the best we can do.

If, on the other hand, they want to fix up some Ruby code or learn more
about what makes Rails tick then I think they've come to the right
place.  I'll be surprised on the day that I see this list turn someone
away that needs help with their Ruby code just because it's for use in a
Rails app.

Matthew
38a8230ed3d5c685558b4f0aad3fc74b?d=identicon&s=25 Joe Van Dyk (Guest)
on 2006-01-14 16:15
(Received via mailing list)
On 1/13/06, Matthew Desmarais <desmarm@gmail.com> wrote:
> >>>>> This is better posted to the Rails list:
> >>>
> > mailing list actually does a service, rather than a disservice.  If
> > they did not know it existed before, they find a great new resource,
> > otherwise, they just know where to ask next time.
> >
> > Though, I usually try to offer whatever help I can with a question,
> > THEN point people to the rails list, just to be nice ;)
> >
> Once again, GBrown beats me to it.  I agree.

For some reason, I think "Google Brown" when I see "GBrown".  Like
it's some Google project or something.
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-01-14 18:32
(Received via mailing list)
On 1/14/06, Joe Van Dyk <joevandyk@gmail.com> wrote:
> On 1/13/06, Matthew Desmarais <desmarm@gmail.com> wrote:
> > Gregory Brown wrote:
> > Once again, GBrown beats me to it.  I agree.
>
> For some reason, I think "Google Brown" when I see "GBrown".  Like
> it's some Google project or something.

It kind of reminds me of M. Bison in street fighter.
Though it would be interesting if I were a google project.
My pockets are not overflowing with money, so i know that can't be true
;)
0817571d150afead454f4220007042fe?d=identicon&s=25 Matthew Desmarais (Guest)
on 2006-01-14 22:59
(Received via mailing list)
Gregory Brown wrote:
>
> It kind of reminds me of M. Bison in street fighter.
> Though it would be interesting if I were a google project.
> My pockets are not overflowing with money, so i know that can't be true ;)
>
Sorry if I caused any confusion.  For what it's worth, I think that Greg
Brown would make a fine Google project although I'm not sure what it is
that he would do.
C1bcb559f87f356698cfad9f6d630235?d=identicon&s=25 Hal Fulton (Guest)
on 2006-01-14 23:05
(Received via mailing list)
Matthew Desmarais wrote:
>
> Sorry if I caused any confusion.  For what it's worth, I think that Greg
> Brown would make a fine Google project although I'm not sure what it is
> that he would do.
>

I'm not sure, but I think a good slogan would be, "What can
Brown do for you?"


Hal
31e038e4e9330f6c75ccfd1fca8010ee?d=identicon&s=25 Gregory Brown (Guest)
on 2006-01-15 01:40
(Received via mailing list)
On 1/14/06, Hal Fulton <hal9000@hypermetrics.com> wrote:
> Matthew Desmarais wrote:
> >
> > Sorry if I caused any confusion.  For what it's worth, I think that Greg
> > Brown would make a fine Google project although I'm not sure what it is
> > that he would do.
> >
>
> I'm not sure, but I think a good slogan would be, "What can
> Brown do for you?"

A google / UPS merger in the works?  I doubt I'd be creative enough to
figure that one out ;)
C1bcb559f87f356698cfad9f6d630235?d=identicon&s=25 Hal Fulton (Guest)
on 2006-01-15 06:57
(Received via mailing list)
Gregory Brown wrote:
>>Brown do for you?"
>
>
> A google / UPS merger in the works?  I doubt I'd be creative enough to
> figure that one out ;)
>

Oh, is that UPS? I thought it was Ex-Lax.   :D


Hal
This topic is locked and can not be replied to.