<commit_before>get '/surveys' do
  @surveys = Survey.order(:title)
  erb :'survey/index'
end

get '/surveys/new' do
  erb :'survey/new'
end

get '/surveys/:id' do
  @survey = Survey.find(params[:id])
  erb :'survey/show'
end

post '/surveys' do
  @survey = Survey.find(params[:survey])
    if @survey.save
      flash[:message] = "Survey was saved!"
      redirect '/surveys'
    else
      @errors = @survey.errors.full_messages
      flash[:message] = "Survey not made!"
      erb :'survey/new'
    end
end
<commit_msg>general fixes like passing in an empty survey and also assigning the user_id to the survey<commit_after>get '/surveys' do
  @surveys = Survey.order(:title)
  erb :'survey/index'
end

get '/surveys/new' do
  @survey = Survey.new
  erb :'survey/new'
end

get '/surveys/:id' do
  @survey = Survey.find(params[:id])
  erb :'survey/show'
end

post '/surveys' do
  @survey = Survey.new(params[:survey])
  @survey.user_id = session[:user_id]
    if @survey.save
      flash[:message] = "Survey was saved!"
      redirect '/surveys'
    else
      @errors = @survey.errors.full_messages
      flash[:message] = "Survey not made!"
      erb :'survey/new'
    end
end

{'fraction_non_alphanumeric': 0.1433418150975403, 'fraction_numerical': 0.0, 'mean_word_length': 3.2142857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1848355', 'n_tokens_mistral': 451, 'n_tokens_neox': 450, 'n_words': 111}