james2m / canard

Makes role based authorization in Rails really simple. Wraps CanCan and RoleModel up with a smattering of syntactic sugar, some generators and scopes.
MIT License
125 stars 28 forks source link

Make acts_as_user a noop when the table is missing #2

Closed mjonuschat closed 12 years ago

mjonuschat commented 12 years ago

I hit a problem when running db:migrate or db:setup when the user table does not existing in the database as "acts_as_user" unconditionally tried to access column definitions.

james2m commented 12 years ago

Hi Morton,

I'm thinking of making Canard independent of ActiveRecord in the future so would prefer to still assign roles and only skip the scopes. Would you be able to re-submit with tests?

J.

mjonuschat commented 12 years ago

Thanks for update, but it doesn't solve the problem - just accessing column_names when the table doesn't still throws errors. But the model - at least for ActiveRecord - still responds to column_names

james2m commented 12 years ago

Ah I see. Completely overlooked the bit about db:migrate and there not being a table present. I've a couple of changes in the works so will get that fixed in the next couple of days.

Thanks for the feedback.

mjonuschat commented 12 years ago

Hi. Just wanted to give you a heads up, there's no need for any further action, the root cause is my usage of "draper" for decorators and draper is eager loading all models, triggering this behaviour.

mjonuschat commented 12 years ago

Ignore my last comment - this is still relevant and happens with and without draper

james2m commented 12 years ago

Yeah, I've recreated it. Will release another version shortly with this fix.