Re: can''t convert hash into integer

Ianne Leson
2006-09-26T12:30:25Z

sorry for the incomplete info.  Here''re the details:

#I''ve construct the data object in the controller:
for i in 0..10
  @option[i] = {
    :name => @params[("name"+i.to_s).to_sym],
    :value => @params[("value"+i.to_s).to_sym]
  }
end

#then pass the object to model function
Somemod.funct(
  ...some other parameters...
  :option => @option)

#this is the model function
self.funct(input)
.......
input[:option].each do |opt_k|
  options[opt_k] = Hash.new(0)
  options[opt_k] = OtherClass.new(input[:option][opt_k])

................
end unless input[:option].nil?

#I suspect that the problem is assoc with input[:option][opt_k], which
returns error when I want to put it on screen


Thanks.

unknown wrote:
> Hi --
>
> On Tue, 26 Sep 2006, Ianne Leson wrote:
>
>>
>> anyone has got a clue?  Thanks.
>
> My first suspicion is that, somewhere, you''re trying to use a hash
> where you need an integer :-)  But "blablablab", and no
information
> about what line the error pointed to, makes it hard to say much more.
>
>
> David
>
> --
>                    David A. Black |
dblack-TKXtfPMJ4Ozk1uMJSBkQmQ@public.gmane.org
> Author of "Ruby for Rails"   [1] | Ruby/Rails training &
consultancy [3]
> DABlog (DAB''s Weblog)        [2] | Co-director, Ruby Central, Inc.
[4]
> [1] http://www.manning.com/black | [3] http://www.rubypowerandlight.com
> [2] http://dablog.rubypal.com    | [4] http://www.rubycentral.org


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