ironcamel / Dancer-Plugin-DBIC

DBIx::Class Plugin for Dancer
1 stars 13 forks source link

Calling resultset before schema causes config not to be loaded #19

Closed Relequestual closed 8 years ago

Relequestual commented 8 years ago

I ran into a problem where the code on my machine didn't work, but it did on our staging servers. I eventually dug down to work out that we used a different version of your plugin.

When you moved the chunk of code to DBICx::Sugar, in this plugin you then call DBICx::Sugar's version of schema as opposed to the plugins version of schema. See https://github.com/ironcamel/Dancer-Plugin-DBIC/blob/master/lib/Dancer/Plugin/DBIC.pm#L20

This means that if you call resultset before schema (like you might when writing tests), the config is not loaded. This breaks backwards compatibility from v2102 (current) to v2100.

I'll happily submit a pull request for this.

ironcamel commented 8 years ago

This is fixed in CPAN https://metacpan.org/release/IRONCAMEL/Dancer-Plugin-DBIC-0.2103 Thanks!