app/controllers/valid_emails_controller.rb
# creates a new whitelisted email with a default in_use to false
creates a new whitelisted email with a default in_use to false
creates a new whitelisted email with a default in_use to false
def create
    @valid_email = ValidEmail.new(valid_email_params)
    @valid_email.in_use = false
    redirect_to '/tasks' if current_user.role != 'admin' && current_user.role != 'moderator'
    if @valid_email.save
      redirect_to '/valid_emails'
    else
      render :new
    end
  end
def create @valid_email = ValidEmail . new ( valid_email_params ) @valid_email . in_use = false redirect_to '/tasks' if current_user . role != 'admin' && current_user . role != 'moderator' if @valid_email . save redirect_to '/valid_emails' else render :new end end
creates a new whitelisted email with a default in_use to false
creates a new whitelisted email with a default in_use to false
# only allow admins and moderators to whitelist emails