Are all the accessors created automatically in non-Rails application

I wonder if all the accessors are created automatically in non-Rails
application? By requiring ‘active_record’ and ‘rubygems’ didn’t solve
my problem. I just created a Ruby file with 2 classes inside:
@@@
require ‘rubygems’
require ‘active_record’

ActiveRecord::Base.establish_connection(
:adapter => ‘oracle_enhanced’,
:database => 'db_bname,
:username => 'username,
:password => ‘pwd’
)

class Supplier < ActiveRecord::Base
set_table_name :lcssupplier
set_primary_key :ida2a2
end

class RunUpdate
def initialize(env = “dev”)
@env = env
case @env
when ‘dev’
@name = ‘att1’
else
raise “Unknown environment: #{env}”
end
update_dpp_suplliers
end

private
def update_dpp_suplliers
dpp_supplier = Supplier.where(:num2=>56180).first
puts “Reading supplier name before update:
#{dpp_supplier.read_attribute(@name)}”
dpp_supplier.send("#{@name}=", “TOTO”)
dpp_supplier.save!
puts “DPP supplier name AFTER update:
#{dpp_supplier.read_attribute(@name)}”
end
end

RunUpdate.new(‘dev’)
@@@

It works without problem on another database (MySQL) but raises an
error on Oracle DB. The only difference is that when running on MySQL
DB, I didn’t have to use ‘set_table_name’ and ‘set_primary_key’
because the table was created according the RoR convention. It’s not
the case for Oracle table.
Here is the error I get:
@@@
Reading supplier name before update: DP China / Shanghai - SHENZHOU
KNITTING(AN HUI)CO.LTD
C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/
attribute_methods.rb:271:in module_eval': C:/Ruby192/lib/ruby/gems/ 1.9.1/gems/activemodel-3.0.5/lib/active_model/attribute_methods.rb: 272: syntax error, unexpected tGVAR, expecting ')' (SyntaxError) if method_defined?(:blob$entrysetadhocacl?) ^ C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/active_model/ attribute_methods.rb:273: syntax error, unexpected tGVAR, expecting $end undef :blob$entrysetadhocacl? ^ from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/ active_model/attribute_methods.rb:271:inblock (2 levels) in
define_attribute_methods’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/
active_model/attribute_methods.rb:262:in each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/ active_model/attribute_methods.rb:262:inblock in
define_attribute_methods’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/
active_model/attribute_methods.rb:261:in each' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activemodel-3.0.5/lib/ active_model/attribute_methods.rb:261:indefine_attribute_methods’
from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/
lib/active_record/attribute_methods.rb:13:in
define_attribute_methods' from C:/Ruby192/lib/ruby/gems/1.9.1/gems/activerecord-3.0.5/ lib/active_record/attribute_methods.rb:41:inmethod_missing’
from C:/Documents and Settings/MACHINE_DEV3/My Documents/
ror_prj/ruby_drafts/lib/update_cnuf_1.rb:44:in update_dpp_suplliers' from C:/Documents and Settings/MACHINE_DEV3/My Documents/ ror_prj/ruby_drafts/lib/update_cnuf_1.rb:37:ininitialize’
from C:/Documents and Settings/MACHINE_DEV3/My Documents/
ror_prj/ruby_drafts/lib/update_cnuf_1.rb:51:in new' from C:/Documents and Settings/MACHINE_DEV3/My Documents/ ror_prj/ruby_drafts/lib/update_cnuf_1.rb:51:in
@@@
Any idea ?

On 15 Mar 2011, at 09:07, Javix [email protected] wrote:

I wonder if all the accessors are created automatically in non-Rails
application?

I don’t the behaviour of a rails app is significantly different compared
to a standalone ruby script that happens to use active record.
By the looks of it rails is barfing because it’s trying to define a
method called blob$entrysetadhocacl? which isn’t a legal method name. Do
you have a column of that name?

Fred