On Jan 17, 12:44 pm, Sem Ptiri <[email protected]> wrote: > > klass = class_eval do > set_table_name("#{class_name}") or puts "Class set table name > failed" > Object.const_set(constant_name, klass) or puts "Class name > constant set failed" > end # class_eval > > but get an unknown method error on the set_table_name call.
you don't need the class_eval . just klass.set_table_name should work (I don't think the method is protected, if it is you might have to use send) > > The App class (below) inherits from ActiveRecord::Base which in turn > should have that method. > > class App < ActiveRecord::Base > abstract_class = true > this should be self.abstract_class = true (right now you're just setting a local variable) > def initialize > establish_connection :app_development > end > This is dodgy. First of all you're overriding initialize, but without calling through to the super class, so your activerecord objects won't get initialized properly. You've also change the signature of initialize. Also, do you really want to be reconnecting to the database everytime a new instance is created? lastly this establish_connection is a class method > # to avoid trying to connect to the Spydirdb table by default > def self.columns() @columns ||= []; end > end > > -- > Posted viahttp://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.

