<commit_before>class SheltersController < ApplicationController

  ## SHELTERS INDEX ACTION ##

  get '/shelters' do
    erb :'shelters/index'
  end

  ## CREATE ACTIONS ##

  get '/shelters/new' do
    if !session[:user_id]
      redirect '/signup'
    else
      erb :'shelters/new'
    end
  end

  post '/shelters' do
    if params[:name] == "" ||
       params[:address] == "" ||
       params[:city] == "" ||
       params[:state] == ""
      redirect '/shelters/new'
    else
      shelter = current_user.shelters.create(params)
      redirect "/shelters/#{shelter.id}"
    end
  end

  ## SHOW/READ ACTION ##

  get '/shelters/:id' do # maybe do this by slug later instead?
    @shelter = Shelter.find(params[:id])
    erb :'shelters/show'
  end

  ## EDIT ACTIONS ##

  get '/shelters/:id/edit' do
    binding.pry
  end



end









<commit_msg>added shelters get edit action<commit_after>class SheltersController < ApplicationController

  ## SHELTERS INDEX ACTION ##

  get '/shelters' do
    erb :'shelters/index'
  end

  ## CREATE ACTIONS ##

  get '/shelters/new' do
    if !session[:user_id]
      redirect '/signup'
    else
      erb :'shelters/new'
    end
  end

  post '/shelters' do
    if params[:name] == "" ||
       params[:address] == "" ||
       params[:city] == "" ||
       params[:state] == ""
      redirect '/shelters/new'
    else
      shelter = current_user.shelters.create(params)
      redirect "/shelters/#{shelter.id}"
    end
  end

  ## SHOW/READ ACTION ##

  get '/shelters/:id' do # maybe do this by slug later instead?
    @shelter = Shelter.find(params[:id])
    erb :'shelters/show'
  end

  ## EDIT ACTIONS ##

  get '/shelters/:id/edit' do
    if logged_in?
      @shelter = Shelter.find(params[:id])
      if @shelter.user_id == current_user.id
        erb :'shelters/edit'
      else
        redirect '/shelters'
      end
    else
      redirect '/login'
    end
  end



end










{'fraction_non_alphanumeric': 0.13858835651725915, 'fraction_numerical': 0.0, 'mean_word_length': 2.2915254237288134, 'pattern_counts': {'":': 0, '<': 5, '<?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': '3732009', 'n_tokens_mistral': 696, 'n_tokens_neox': 674, 'n_words': 156}