:)

```ruby

def check_slug
    valid = false
    valid = true if Project.permalink_on_routes?(params[:permalink]) || Project.where("lower(permalink) = ?", params[:permalink].downcase).present?

    render json: { available: valid }.to_json  
end

```