Valery Kvon wrote in post #1017132:
> If I'm not mistaking, Rails in any case when found file name(.rb) named
> (passing .tableize method) as a table name, it accepts that file as a
> model file and seeking the class according to a convention(!) passing
> .classify.constantize chunk of methods. In your case you have to play
> with:
> 1) rename table name "known_ips" to "known_ip_addresses" you are picky
> :)
> 2) set_table_name "known_ip_addresses" to a KnownIP class.
> 3) file name "known_ip" you can leave as is.

Thanks for the answer.

2) yes, i have set the table name in my class with  set_table_name.

1,3) i do not want to rename the table or the class, or the file yet, as
the application works fine.
I just want to find out how to override Rails autoloading in this case
(for Unit Tests).

I have tried putting "autoload" in my test_helper.rb, but it didn't work
because (i cheated in my question) my KnownIP is in Admin module, so it
is Admin::KnownIP, and autoload does not want to accept

  autoload 'Admin::KnownIP', path

with an error: "autoload must be constant name: Admin::KnownIP
(NameError)"

I have not tested yet if autoload in this case would work without
Admin::.

Alexey.

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

Reply via email to