Open cforcey opened 11 years ago
This shouldn't be too hard for me to fix. It sounds like a similar issue to one I fixed in authlogic.
I'm travelling right now, so will fix when I get a little downtime. Or happy to get pull requests ;)
on Heroku, when you put the if ActiveRecord::Base.connected?
you can get undefined method admin? error as User got not initialized at all with roles.
A fix was to move the line from add this to config/application.rb :
initializer "canard.initialize_roles",:after => "active_record.log_runtime" do |app|
User.acts_as_user :roles => [:manager, :admin,:superadmin]
end
With Rails 4.0 beta1, devise loads the user model which, in turn, loads canard which checks it for a role matrix. This is fine if the database exists, but as many of us know from painful experience Heroku does not bring the database up before running the precompile. As a result you see:
The workaround that got Heroku back up and running was to only run the canard helper if the connection is present.
Not sure if anything can be done on the code side but if it was built in to the matrix check that would help. Possible? Necessary? Thanks so much for the wonderful work on this gem. I rolled my own at first and then appreciated the hard work that went into this gem all the more.