# APP_TABLES contain a list of table names - would be better to
dynamically read them after connecting
APP_TABLES.each do |table_name|
class_name = table_name.camelize
klass = Class.new(App)
constant_name = "#{class_name}"
# even though klass is created with App as superclass (inheriting from
ActiveRecord::Base, the set_table_name seems to be unavailable - what am
I missing here?
klass.set_table_name ("#{class_name}") or puts "Class set table name
failed"
klass.const_set(constant_name, klass) or puts "Class name constant set
failed"
eval("#{table_name} = #{class_name}.new") or puts "Class instantiation
failed"
end
How can I determine if the klass has actually been created?
How long will the dynamic classes exist in memory?
For the duration of this rake task execution?
Is there a way to list classes created at runtime?
--
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.