Forum: Ruby Spaces in between brackets

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.
12a71a456ac3d464914a8267f11d43b3?d=identicon&s=25 unknown (Guest)
on 2006-02-02 16:27
(Received via mailing list)
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?
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-02-02 16:39
(Received via mailing list)
semmons99@gmail.com wrote:
> 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.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
A6ce942e03edad55d9b504c1e1d859d6?d=identicon&s=25 Jim Freeze (Guest)
on 2006-02-03 05:29
(Received via mailing list)
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
Bc6d88907ce09158581fbb9b469a35a3?d=identicon&s=25 James Britt (Guest)
on 2006-02-03 07:09
(Received via mailing list)
Jim Freeze wrote:
>
> 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.ruby-doc.org       - Ruby Help & Documentation
http://www.artima.com/rubycs/ - The Journal By & For Rubyists
http://www.rubystuff.com      - The Ruby Store for Ruby Stuff
http://www.jamesbritt.com     - Playing with Better Toys
http://www.30secondrule.com   - Building Better Tools
A6ce942e03edad55d9b504c1e1d859d6?d=identicon&s=25 Jim Freeze (Guest)
on 2006-02-03 07:21
(Received via mailing list)
On Feb 3, 2006, at 12:07 AM, James Britt wrote:

>> 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
12a71a456ac3d464914a8267f11d43b3?d=identicon&s=25 semmons99@gmail.com (Guest)
on 2006-02-03 15:08
(Received via mailing list)
Thanks for the help, I will move over to the rails list from now on.
This topic is locked and can not be replied to.