[Ironruby-core] Ordered active record attributes hash

Eduardo Blumenfeld lists at ruby-forum.com
Sat Jul 31 15:32:26 EDT 2010

Hi all,

I found the solution for this puzzle:

Active record, when you call the procedure attributes, it sorts the
attributes by key, so, by working in the following way, that works


instead of


Thank you anyways


Eduardo Blumenfeld wrote:
> Hi All:
> I'm trying to traverse the active record attributes hash in the order it
> was created.
> ------------------
> a = Table.find_by_sql("select * from sometable")
> a.each { |row| puts row.to_yaml
> # prints the the attributes in the order coming from the select
> statement
> # which is exactly how I would like to process the columns
> puts row.attributes.to_yaml
> # shows the attributes in sorted order...
> }
> ------------------
> Is that a problem with activerecord?
> how I could solve the issue?

Posted via http://www.ruby-forum.com/.

More information about the Ironruby-core mailing list