# \[ActiveRecord\] new connector implementation gives 'unknown attribute error'

**URL:** <https://www.ruby-forum.com/t/activerecord-new-connector-implementation-gives-unknown-attribute-error/168184>\
**Category:** Rails\
**Created:** [May 17, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/activerecord-new-connector-implementation-gives-unknown-attribute-error/168184 "2009-05-17T22:47:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gabriele\_Modena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/f19dbf/32.png) [@Gabriele\_Modena](https://www.ruby-forum.com/u/Gabriele_Modena)\
**Post date:** [May 17, 2009, 10:47pm UTC](https://www.ruby-forum.com/t/activerecord-new-connector-implementation-gives-unknown-attribute-error/168184/1 "2009-05-17T22:47:55Z")

</div>

Hi all,  
I’m implementing an activerecord connector on top of a database driver  
I wrote (in pure ruby).

The platform of reference is a Mac OSX 10.5 box with the shipped ruby  
interpreter version 1.8.6 and activerecord 2.3.2.

Table creation and select queries work; I though have some problems  
when I try to perform insertion.

As an example I created a table called ‘albums’:

ActiveRecord::Schema.define do  
create\_table :albums do |table|  
table.column :title, :string  
table.column :performer, :string  
end  
end

class Album \< ActiveRecord::Base  
end

Manual insertion works:  
sql\>insert into albums (title, performer) values (‘a’, ‘b’);

±—±-------±-------------+  
| id | title | performer |  
+==+====+=======+  
| 1 | a | b |  
±—±------±--------------+

Selection seems to be working:

puts Album.find(:first)[‘title’]

returns:

“a”

When I try to call the create method though I get an AttributeError:

album = Album.create(:title =\> ‘Black and Blue’, :performer =\> ‘The  
Rolling Stones’)

/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active\_record/  
base.rb:2745:in `attributes=’: unknown attribute: title  
(ActiveRecord::UnknownAttributeError)

When enabling Logger I get the following:

Exception occurred during reader method compilation.  
Maybe “performer” is not a valid Ruby identifier?  
compile error  
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active\_record/  
attribute\_methods.rb:211: syntax error, unexpected tSTRING\_BEG  
def “performer”; missing\_attribute(’“performer”’, caller) unless  
@attributes.has\_key?(’“performer”’); @attributes[’“performer”’]; end  
^  
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.2/lib/active\_record/  
attribute\_methods.rb:211: syntax error, unexpected kEND, expecting  
$end  
def “performer”; missing\_attribute(’“performer”’, caller) unless  
@attributes.has\_key?(’“performer”’); @attributes[’“performer”’]; end

[…]

May there be any problem with the implementation of my database  
driver? Maybe type conversion?  
I googled but I was not able to find any hint to solve this or at  
least things I should check.

Kind regards.
