Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Ruby Programming Language

range object as a parameter


I trying to use a range object from an array of ranges objects as a parameter

  my_range = [(0..2), (2..5), (5..10), (10..15), (15..25)]

  props = []
  domains = Domain.find(:all)
  # keep track of the number of domains
 @ props[0] = domains.nitems
  k = params[:id]  # can be 0, 1 ,2,3,4

  1.step(domains.nitems,1) do |d|
        props[d] = Proposition.find_by_range( ( my_range[k ] )  , ......... )
        d = d.next
  end

I got an error  :  can't convert String into Integer  in the line :
props[d] = Proposition.find_by_range( ( my_range[k ] )  , ......... )

is is wrong ?

thanks for your help

joss

Here's a guess:  k is a String?  Array indices can only be Integers -
try my_range[k.to_i].

--
Alex

On 2007-05-28 20:09:43 +0200, Alex Young <a@blackkettle.org> said:

thanks that's it... I was not searching for the right problem... could
not find the right solution...

4 years better than 2...  don't know why we have been created like that
! (or "evolutionned".......  ;-)))

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc