You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 #<RailsBlogEngine::PostsController:0xba5d9fc>`
I'm actually using omniauth/mongoid user model, 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
The text was updated successfully, but these errors were encountered:
I've an app which mix MongoDB and MySQL, I had a try with rails_blog_engine, but got the following error :
I'm actually using omniauth/mongoid user model, setting :
field :admin, type: Boolean
in my app/models/user.rb,in app/controllers/application_controller.rb I've got :
my app/models/ability.rb is like the following :
The text was updated successfully, but these errors were encountered: