Hi - see below...

hema gonaboina wrote:
...
> 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

You used 'Fields' above instead of 'fields' here.

>       res << { field => employee.send(field)}

res[field] = employee.send(field)

'res' is a hash.  You build it by setting key/value pairs not pushing
onto a sequential array.
That should probably do it.

Some other things that might be of interest:
   employee.attributes
will give you a hash of all the fields and their values for an
employee object but you might only be wanting a subset.  (You could
'delete' them.)
   Employee.column_names
will give you an array of all the column names.


>    end
> result << res
> end
> But it is not working...
>
> Finally i have to replace the 'result' with the PDF::SimpleTable.data
> through the statement
>
> => table.data.replace result
>
> which accepts only the hashes... whose columns are the keys and the column
> data as values
>
>
>  Please Help me Thank You

--
Daniel Bush
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to