Frederick Cheung wrote in post #975672:
> That's just what you're printing out - the return value of
> set_table_name isn't documented, so i wouldn't assume nil or false to
> mean failure
OK, so I'm down to:
class ExternalApp < ActiveRecord::Base
self.abstract_class = true
establish_connection :external_app
def self.columns() @columns ||= []; end
end
#App tables has a list of tables in external app, until I get this bit
working
APP_TABLES.each do |table_name|
constant_name = class_name = table_name.camelize
klass = Class.new(ExternalApp)
klass.set_table_name ("#{class_name}")
klass.const_set(constant_name, klass)
eval("#{table_name} = #{class_name}.new") or puts "Class instantiation
failed"
end
On running this rake task I get the following error:
lib/rspec/core/backward_compatibility.rb:20:in `const_missing':
uninitialized constant Services
Is const_set where the klass name is 'set in stone'?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.