[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Spaces in between brackets

Shane Emmons

2/2/2006 3:21:00 PM

Can anyone explain to me why the code works:

<input id="recipe_title" name="recipe[title]"

While this code doesn't:

<input id="recipe_title" name="recipe[ title ]"

I know that most people don't put spaces in between brackets, however I
like to for readability. It seems like I can do this everywhere in Ruby
and Rails except for the name of html tag. Any thoughts on why this is?

5 Answers

james_b

2/2/2006 3:39:00 PM

0

semmons99@gmail.com wrote:
> Can anyone explain to me why the code works:
>
> <input id="recipe_title" name="recipe[title]"
>
> While this code doesn't:
>
> <input id="recipe_title" name="recipe[ title ]"
>
> I know that most people don't put spaces in between brackets, however I
> like to for readability. It seems like I can do this everywhere in Ruby
> and Rails except for the name of html tag. Any thoughts on why this is?
>

Because Rails magically converts "recipe[ title ]" into
recipe[" title "]

And " title " != "title"

But, for the future, you would do better to direct Rails questions to
the Rails mailing list.



--
James Britt

http://www.ru... - Ruby Help & Documentation
http://www.artima.c... - The Journal By & For Rubyists
http://www.rub... - The Ruby Store for Ruby Stuff
http://www.jame... - Playing with Better Toys
http://www.30seco... - Building Better Tools


Jim Freeze

2/3/2006 4:29:00 AM

0

On Feb 2, 2006, at 9:39 AM, James Britt wrote:

> Because Rails magically converts "recipe[ title ]" into
> recipe[" title "]
>
> And " title " != "title"
>
> But, for the future, you would do better to direct Rails questions
> to the Rails mailing list.

I don't know. Seems like he got his question answered pretty well on
this list.

Jim Freeze





james_b

2/3/2006 6:08:00 AM

0

Jim Freeze wrote:
> On Feb 2, 2006, at 9:39 AM, James Britt wrote:
>
>> Because Rails magically converts "recipe[ title ]" into
>> recipe[" title "]
>>
>> And " title " != "title"
>>
>> But, for the future, you would do better to direct Rails questions to
>> the Rails mailing list.
>
>
> I don't know. Seems like he got his question answered pretty well on
> this list.

Yeah, well, it happens. (And this was one of those unintuitive Rails
things that bit me, too, so I'm sympathetic.)


--
James Britt

http://www.ru... - Ruby Help & Documentation
http://www.artima.c... - The Journal By & For Rubyists
http://www.rub... - The Ruby Store for Ruby Stuff
http://www.jame... - Playing with Better Toys
http://www.30seco... - Building Better Tools


Jim Freeze

2/3/2006 6:21:00 AM

0


On Feb 3, 2006, at 12:07 AM, James Britt wrote:

> Jim Freeze wrote:
>> On Feb 2, 2006, at 9:39 AM, James Britt wrote:
>>> Because Rails magically converts "recipe[ title ]" into
>>> recipe[" title "]
>>>
>>> And " title " != "title"
>>>
>>> But, for the future, you would do better to direct Rails
>>> questions to the Rails mailing list.
>> I don't know. Seems like he got his question answered pretty well
>> on this list.
>
> Yeah, well, it happens. (And this was one of those unintuitive
> Rails things that bit me, too, so I'm sympathetic.)

We need to tell those rails core folks about #strip. And, #strip! is
very fast.

Jim Freeze





Shane Emmons

2/3/2006 2:07:00 PM

0

Thanks for the help, I will move over to the rails list from now on.