user646560
user646560

Reputation:

Making changes to the devise user controller in rails?

I have started using devise for my rails app, however i need to make some changes to the controller logic that devise has, my problem is that i assign users roles, and i want to put in params[:user][:role_ids] ||= [] in the update action so if all the roles are unchecked then it actually works.

whats the best way to do this?

Upvotes: 9

Views: 7109

Answers (1)

Mike Lewis
Mike Lewis

Reputation: 64147

class UsersController < Devise::SessionsController
  def create
    super
  end
 def update
   #edit here
 end
end

and make sure you update your routes.rb file:

devise_for :users, :controllers => { :sessions => 'users/sessions' } 

Upvotes: 17

Related Questions