Forum: Ruby on Rails params with '.' dot in them

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.
464c5a2bd1382891fd301d3c2c1c7b93?d=identicon&s=25 B. Lars (Guest)
on 2007-01-29 17:48
(Received via mailing list)
Hi this is my first post on the group and I think its an easy
question.

How do I assign a variable from parameter with a '.' dot in it.
For instance

filename=(params[:Manual.pdf])

Thanks
C4dc94c893471878a105761a9207f29b?d=identicon&s=25 Zack Chandler (Guest)
on 2007-01-29 17:57
(Received via mailing list)
filename = params['Manual.pdf']

Hope that helps.

--
Zack Chandler
http://depixelate.com
464c5a2bd1382891fd301d3c2c1c7b93?d=identicon&s=25 B. Lars (Guest)
on 2007-01-29 18:07
(Received via mailing list)
filename = params['Manual.pdf']
does not set filename for me. Any other ideas?
Aafa8848c4b764f080b1b31a51eab73d?d=identicon&s=25 Phlip (Guest)
on 2007-01-29 18:13
(Received via mailing list)
B. Lars wrote:
>
> filename = params['Manual.pdf']

Why is the dot in the key?

Why does 'Manual.pdf' look like a value (a real name of a real file)
instead of an abstraction, like :filename?

If Manual.pdf really really is the key, try params[ :'Manual.pdf' ]

> Any other ideas?

p params
raise params.inspect

Both of those .inspect the keys, and .inspect generally turns any
"instant value" into its own Ruby expression. That will show you how
to write your :symbol.

--
  Phlip
  http://c2.com/cgi/wiki?ZeekLand  <-- NOT a blog!!
464c5a2bd1382891fd301d3c2c1c7b93?d=identicon&s=25 B. Lars (Guest)
on 2007-01-29 18:14
(Received via mailing list)
Nevermind i got it to work, thank you for the help.
464c5a2bd1382891fd301d3c2c1c7b93?d=identicon&s=25 B. Lars (Guest)
on 2007-01-29 20:29
(Received via mailing list)
Phlip

Yeah that was my problem, I just mindlessly switched the key with the
value.
This topic is locked and can not be replied to.