Hi!!
I am newbie on ruby and I have questions and troubles, can you help me
out?
This is the html and the view
<select name="select" multiple size="3">
<option value="audi">Audi</option>
<option value="bmw">BMW</option>
<option value="dodge">Dodge</option>
<option value="nissan">Nissan</option>
<option value="renault">Renault</option>
</select>
The idea is to choose only one and that one show another list box with
some results, for example:
I want an audi, I selected the audi and then another list box shows the
types of audi: sedan, coupe,…
This the code I have:
def type
@audi=Array.new
@audi=['audi 1','audi 2','audi 3','audi 4']
@bmw=Array.new
@bmw=['bmw 1','bmw 2','bmw 3','bmw 4']
@dodge=Array.new
@dodge=['dodge 1','dodge 2','dodge 3','dodge 4']
@nissan=Array.new
@nissan=['nissan 1','nissan 2','nissan 3','nissan 4']
@renault=Array.new
@renault=['renault 1','renault 2','renault 3','renault 4']
@type=params[:select]
option=@type
case option
when audi
puts @audi
when bmw
puts @bmw
when dodge
puts @dodge
when nissan
puts @nissan
when renault
puts @renault
end
end
This code is bad?, good?, something are missing.?
thanks for the help