I assume that this has been answered, I just haven’t been able to find
it…I have a database with a 10 tables named: data_table_00 through
data_table_09. They are all identical and I’m new to Ruby and trying to
figure out the best way, using ActiveRecord, to define the class. I
would like to be able to specify the table number at initialization.
I have done:
irb> class DataTable < ActiveRecord::Base
irb> dt0 = DataTable.set_table_name ‘data_table_00’
And that seems to work - of course irb gives me lots of output…but
we’ll skip that part. But I was just wondering if there’s a “cleaner”
way to do this.