If you want to fork it and upload your changes then other ppl can play with your version and see if it helps them in anyway. I'm not sure of the userbase for the gem, so I'm a bit concerned with applying patches at the moment :D
On Wed, Apr 30, 2008 at 6:10 AM, Matt Wilson <
m...@hypomodern.com> wrote:
Dr. Nic,
I've been tinkering with your magic_models, since I think they're a perfect fit for my needs. However, I'm only interested it having it pick up tables within a particular couple of namespaces, as in your example here:
"Only want to pick up tables starting with blog_? ..."
But it looks as though it is still picking up other random tables in the schema (legacy schema on SQL Server, argh, so it is picking up tables like schema_info) despite my call to, in my particular case:
module EquipmentType
magic_module :table_name_prefix => 'equipment_'
end
I see in the logfiles that Module#const_missing is firing on Object, so I hacked in a simple "return normal_const_missing(class_id) if self === Object" line to that bit. I can probably use it without exclusive scope, but why should I have it go through the trouble (and potentially facilitate dangerous behavior with a magic SchemaInfo model), right?
My question is: is that the right thing to have done? I mean, it works the way I want it to, but is there a builtin way that I have missed to have it skip performing its marvelous mysterious magic in the Object namespace?
Thanks a ton for your metaprogramming magics,
-mhw
--
Dr Nic Williams
http://drnicacademy.com - Ruby/Rails training/dev around the world
http://drnicwilliams.com - Ruby/Rails/Javascript/Web2.0
(skype) nicwilliams
(p)
+61 412 002 126 /
+61 7 3113 3033(mail) PO Box 583 Ashgrove 4060 QLD Aus