Skip to content

Instantly share code, notes, and snippets.

@harrisonmalone
Last active October 21, 2018 11:30
Show Gist options
  • Save harrisonmalone/55671deecfc57550d2c698bd474ef3c2 to your computer and use it in GitHub Desktop.
Save harrisonmalone/55671deecfc57550d2c698bd474ef3c2 to your computer and use it in GitHub Desktop.
bit.ly rails copy
<h1>Link shortener</h1>
<%= form_for(Link.new, url: link_path) do |f| %>
<%= f.text_field :original_url %>
<%= f.submit "Create short link" %>
<% end %>
Rails.application.routes.draw do
root to: 'links#index'
get 'links/:id', to: 'links#show', as: 'link_show'
post 'link', to: 'links#create'
get '/:hash', to: 'links#go_to_link', as: 'go_to_link'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment