class RegistrationsController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(secure_params)
    if @user.save
      log_in(@user)
      UserMailer.registration_email(@user).deliver_later #TODO change adapter
      redirect_to dashboard_path
    else
      flash.now[:error] = @user.errors.full_messages
      render :new
    end
  end

  private

  def secure_params
    params.require(:user).permit(:username, :email, :password, :terms_and_conditions)
  end
end

class RegistrationsController < ApplicationController
  def new
    @user = User.new
  end

  def create
    @user = User.new(secure_params)
    if @user.save
      log_in(@user)
      UserMailer.registration_email(@user).deliver_later # TODO change adapter
      redirect_to dashboard_path
    else
      flash.now[:error] = @user.errors.full_messages
      render :new
    end
  end

  private

  def secure_params
    params.require(:user).permit(:username, :email, :password, :terms_and_conditions)
  end
end

Add missing space to comment
Add missing space to comment