can't convert hash into integer

Hi --

Hi --

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])

You're assigning to options[opt_k] twice, which means the first assignment will get clobbered.

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

That sounds right. input[:option] is an array, and you're trying to index it with a hash (opt_k) instead of an integer. (I'm assuming options is a hash; if it's an array, then you've got the same problem there too.)

I'm not clear on what you're trying to do in that each loop, so I'm not sure what the right code would be, but you'll need to make sure not to use a hash to index an array.

David