ignore_table_columns fails

6 views
Skip to first unread message

Serguei Cambour

unread,
Jun 22, 2018, 9:54:37 AM6/22/18
to Oracle enhanced adapter for ActiveRecord
I have a legacy schema where table names and their colums are all in uppercase.
So following the README legacy schema support section, I define my model as follows:

lass SomeModel < ActiveRecord::Base
 
self.table_name = 'AUTHOR'
 
self.primary_key = "AUTH_ID"


  alias_attribute
:id, 'aut_id'
  alias_attribute
:first_name, 'aut_first_name'
  alias_attribute
:last_name, 'aut_last_name'


  ignore_table_columns
'AUT_LOGIN'
end

Then I checked it:

author = SomeModel.take
puts author
.inspect
puts
"first Author: id: #{author.id}, #{author.first_name} #{author.last_name}"


Here is the output:


lib ruby db_oracle_connection
.rb
Traceback (most recent call last):
 
2: from db_oracle_connection.rb:37:in `<main>'
  1: from db_oracle_connection.rb:45:in `
<class:SomeModel>'
/Users/Serguei/.rvm/gems/ruby-2.5.0/gems/activerecord-5.2.0/lib/active_record/dynamic_matchers.rb:22:in `method_missing'
: undefined method `ignore_table_columns' for SomeModel (call 'SomeModel.connection'


First thing I noticed, - that I had to declare original column names in lower case:
alias_attribute :first_name, 'aut_first_name'



instead of 

alias_attribute :first_name, 'AUT_FIRST_NAME'

Another point is, no matter what I pass in to 
ignore_table_columns

, nothing works. What is the right way to ignore table columns ? Thank you.





Reply all
Reply to author
Forward
0 new messages