Wednesday, October 3, 2012

Customizing devise views & controllers

I find myself repeating and googling this far too many times...

# Generate the devise views
rails g devise:views

# Add customize views resource to route
devise_for :users, controllers: { registrations: "users/registrations" }

# Move views to new resource folder
git mv app/views/devise/registrations/ app/views/users/

# Add new custom devise controller
class Users::RegistrationsController < Devise::SessionsController

  def new
    @user = User.new
  end

  def create
    ...
  end

end

No comments: