# ActiveRecord::Base.connection =\> duplicate values

**URL:** <https://www.ruby-forum.com/t/activerecord-base-connection-duplicate-values/122887>\
**Category:** Rails\
**Created:** [December 12, 2007, 7:26pm UTC](https://www.ruby-forum.com/t/activerecord-base-connection-duplicate-values/122887 "2007-12-12T19:26:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![raimon](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/59ef9b/32.png) [@raimon](https://www.ruby-forum.com/u/raimon)\
**Post date:** [December 12, 2007, 7:26pm UTC](https://www.ruby-forum.com/t/activerecord-base-connection-duplicate-values/122887/1 "2007-12-12T19:26:34Z")

</div>

Hello,

I’m trying to implement a free SQL sender, and I’m using this control:

def expert\_mode\_result

```
c = ActiveRecord::Base.connection
@result = c.execute(params[:expert_command])
render :partial => "expert_mode_result", :layout =>false

```

end # expert\_mode\_result

as a test, I’m sending this SQL:

SELECT nc8, nacer FROM masters LIMIT 1

and, in the web page, if I dump the @result, I get:

* * *

- 0: “02011000”  
1: “1511”  
nc8: “02011000”  
nacer: “1511”

What I don’t understand, is why I’m getting 4 attributes, when I really  
asked only for two, the nc8 and the nacer. I don’t know if it’s trying  
to get the id.

If I send the same sql with the limit to 5, I’m also getting duplicate  
values inside each element, and 4 attributes.

here’s the dump:

* * *

- 0: “02011000”  
1: “1511”  
nc8: “02011000”  
nacer: “1511”
- 0: “02011010”  
1: “1511”  
nc8: “02011010”  
nacer: “1511”
- 0: 02011090  
1: “1511”  
nc8: 02011090  
nacer: “1511”
- 0: “02012011”  
1: “1511”  
nc8: “02012011”  
nacer: “1511”
- 0: 02012019  
1: “1511”  
nc8: 02012019  
nacer: “1511”

any idea ?

thanks,

rai
