Devise with cancan rails?

Up vote 0 down vote favorite share g+ share fb share tw.

I am using Devise(1.4.2) with Cancan. I have followed this and this link. I have 2 roles viz.

Admin and developer, with a controller -> Projects. I have allowed all the access rights to developer as well as admin, still I get the following error while accessing projects/index. Error : CanCan::AccessDenied in ProjectsController#index You are not authorized to access this page.

Following is my code : ===== ability. Rb ===== class Ability include CanCan::Ability def initialize(user) user ||= User. New puts user.

Role puts user. Username can :manage, :all if user. Role == "admin" can :manage, :all if user.

Role == "developer" end end ===== Projects Controller ===== class ProjectsController :show, :index #check_authorization load_and_authorize_resource ..... end ===== user. Rb (model) === class User "projects#index" end Any suggestions? Thanks in advance ruby-on-rails-3 devise cancan link|improve this question asked Aug 11 '11 at 5:10Rashmi21218 51% accept rate.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions