On 19 Jan 2011, at 08:05, Sem Ptiri <[email protected]> wrote:

> #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'?

It is, but you're using it back to front: klass.const_set sets a constant on 
klass, whereas you want to set a top level constant ie Object.const_set

Fred. 
> 
> -- 
> 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.
> 

-- 
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.

Reply via email to