Robert Klemme wrote in post #1027788:
> On Fri, Oct 21, 2011 at 4:26 PM, DM W. <dwhelan / rallydev.com> wrote:
>> I am attempting to create data via a ruby script. One of the require
>> fields I need to populate is named:
>> (aard.DLL$)
>>
>> I tried using:
>> :"(aard.dll$)".to_sym => "kimchi" but it did not work. I also tried
>> ":(aard.dll$)".to.sym => "kimchi"
>> :"(aard.dll$)" => "kimchi"
>
> All these are invalid syntaxes - but not because of special characters
> in the Symbol but rather because you cannot simply do "expr1 =>
> expr2".
>
>> Any ideas? I am a novice, but tried searching online for symbol
>> identifiers with special characters and could not find anything.
>
> First, you do not need to append #to_sym:
>
> irb(main):001:0> :"(aard.dll$)" == :"(aard.dll$)".to_sym
> => true
>
> Second, maybe you just have the case wrong, because
>
> irb(main):002:0> :"(aard.DLL$)" == :"(aard.dll$)"
> => false
>
> Please note also that in all these examples no identifier is involved.
>  The item before "=>" is at best a key in a Hash, e.g.
>
> irb(main):003:0> h = {:"(aard.DLL$)" => "kimchi"}
> => {:"(aard.DLL$)"=>"kimchi"}
>
> Can you provide a bit more context that explains what you are trying to
> achieve?
>
> Kind regards
>
> robert

I am trying to to create data via the Rally API (an agile tool). I am 
creating a story and one of the required fields in the story is a drop 
down list named (aard.DDL$). The options for the drop down list are 
kimchi and bulgolgi, but using kimchi is fine (I know how to rotate 
between the two). so normally I would write something like this:
user_story = @rally.create(:user_story, :name => "this is a test", 
:state => "Open", :"aard.ddl$" => "Kimchi")
All work expect the last one. :"aard.ddl$" => "Kimchi"

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