Devise and cancan with rails 3

Devise

Follow the railcast (209-introducing devise) at the following link while for the initial part( Ex installation) there is slight difference.

Run the following instead of railscast mention way.

rails generate devise:install

http://railscasts.com/episodes/209-introducing-devise

For customization

http://railscasts.com/episodes/210-customizing-devise

Run the following instead of railscast mention way.

rails generate devise:views

cancan

Start with tutorial at

https://github.com/ryanb/cancan

refer at

http://www.tonyamoyal.com/2010/07/28/rails-authentication-with-devise-and-cancan-customizing-devise-controllers/

follow at

http://railscasts.com/episodes/192-authorization-with-cancan?

In the ability class used the following code by adding “role” field in the User database

if user.role==’admin’
can :manage, :all
end

by http://www.klairvoyant.in

About http://www.infosolutions.klairvoyant.com/

software development firm
This entry was posted in ruby on rails and tagged , , . Bookmark the permalink.

Leave a comment