clintongormley / Elastic-Model

Use ElasticSearch as a NoSQL database in Perl
9 stars 8 forks source link

Can't get namespace from a model subclass #33

Open miquelruiz opened 10 years ago

miquelruiz commented 10 years ago

Hi!

I don't know if this is an expected behaviour: the "namespace" method called in a subclass of a model always returns "undef".

Here you can find a minimal script in order to reproduce: https://gist.github.com/miquelruiz/8147660

Is there any workaround (or fix) in order to make this work?

Thanks in advance, Miquel Ruiz

clintongormley commented 10 years ago

Heya @miquelruiz

Currently, no, you can't do that. Namespaces are stored in the metaclass, so the myapp namespace is registered against the MyApp class.

We could potentially add some inherit_meta call which would retrieve these settings and add them to the inheriting class. But for now you could just repeat the has_namespace spec in MySubclass itself.