Forum: Ruby on Rails Create pdf using ruby on rails

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Hema G. (Guest)
on 2008-11-27 12:21
(Received via mailing list)
I have a problem,

please check the code

Fields =
Fields [0] = "sno"
Fields [1] = "username"
Fields [2] = "designation"
Fields [3] = "salary"
Fields [4] = "dob"
Fields [5] = "email"
Fields [6] = "doj"

These are the fields of the object 'Employee'

The Employees array contains of the set of employee objects...

I need to have the array of hashes as
[{employee_record1},{employee_record2}...... n records]

For this i tried as the...

result = []

for employee in Employees
res = {}
    for field in fields
      res << { field => employee.send(field)}
result << res
But it is not working...

Finally i have to replace the 'result' with the
through the statement

=> result

which accepts only the hashes... whose columns are the keys and the
data as values

 Please Help me Thank You
This topic is locked and can not be replied to.