[Rails] Problem with array of hashes

2012-06-05 Thread cyber c.
Hi , I have created an array of hashes using Model file class Class A ActiveRecord::Base def fill_paths paths = Array.new for file in @files path = {} path[a] = file path[b] = DATA2(assume data2 is valid) paths path end return paths end in controller class

Re: [Rails] Problem with array of hashes

2012-06-05 Thread Jeremy Walker
On 5 Jun 2012, at 18:58, cyber c. li...@ruby-forum.com wrote: Hi , I have created an array of hashes using Model file class Class A ActiveRecord::Base def fill_paths paths = Array.new for file in @files path = {} path[a] = file path[b] = DATA2(assume data2

[Rails] problem with array to integer convertion

2009-11-17 Thread INDRANIL MUKHERJEE
**this is the error: undefined method `to_i' for [5]:Array **this is the code: sql = ActiveRecord::Base.connection(); @loo = sql.execute(select count(name) from data1.items).fetch_row; @loo = @loo.to_i Plz help; it is urgent. regards, INDRANIL MUKHERJEE -- You received this message

Re: [Rails] problem with array to integer convertion

2009-11-17 Thread Adam Jones
@loo = @loo.first.to_i On Wed, Nov 18, 2009 at 6:26 PM, INDRANIL MUKHERJEE indranil.sinc...@gmail.com wrote: **this is the error: undefined method `to_i' for [5]:Array **this is the code: sql = ActiveRecord::Base.connection(); @loo = sql.execute(select count(name) from

[Rails] Problem with array

2009-08-21 Thread Soller Prieto
I have two action in the same controller: def list if logged_in? sort = case params['sort'] when title then title when a then a when b then b when c then c when title_reverse then title DESC when a_reverse then a DESC