kiddsoftware/rails_blog_engine — Issue #2: INFO: is it working on mongodb/mongoid ?
Author: lgs
Created: 2011-12-23 22:35:35+00:00
State: open

I've an app which mix MongoDB and MySQL, I had a try with rails_blog_engine, but got the following error :

`undefined local variable or method `current_user' for #`

I'm actually using omniauth, setting :

`field :admin, type: Boolean` in my app/models/user.rb,

in app/controllers/application_controller.rb I've got :

private
def current_user
@current_user ||= User.find(session[:user_id]) if session[:user_id]
end
def current_ability
@current_ability ||= ::Ability.new(current_admin)
end

my app/models/ability.rb is like the following :

class Ability
include CanCan::Ability
include RailsBlogEngine::Ability

def initialize(user)
user ||= User.new # guest user (not logged in)
if user.admin?
can :manage, :all
else
can :read, :all
end

can :update, Article, :published => true
end
end