I am working on the user story "User wants to log in."
I am trying to have the user update their profile.
| require 'active_record' | |
| ActiveRecord::Base.logger = Logger.new( STDOUT ) | |
| ActiveRecord::Base.establish_connection( | |
| :adapter => "postgresql", | |
| :host => "localhost", | |
| :username => "philco", | |
| :password => "", | |
| :database => "amazon_db" |
| require 'sinatra' | |
| require 'sinatra/reloader' if development? | |
| require 'pry' | |
| require 'pg' | |
| require 'active_record' | |
| # require_relative '' | |
| ActiveRecord::Base.logger = Logger.new( STDOUT ) | |
| ActiveRecord::Base.establish_connection( |
| <html> | |
| <head> | |
| <title></title> | |
| <meta charset="utf-8"> | |
| </head> | |
| <body> | |
| <%= yield %> | |
| </body> | |
| </html> |
| group :development, :test do | |
| gem 'pry-rails' | |
| gem 'rspec' | |
| gem 'rspec-rails' | |
| gem 'guard' | |
| gem 'guard-rspec' | |
| gem 'guard-bundler', require: false | |
| gem 'terminal-notifier-guard' | |
| gem 'shoulda-matchers' | |
| gem 'capybara' |
| development: &defaults | |
| adapter: postgresql | |
| encoding: unicode | |
| pool: 5 | |
| host: localhost | |
| username: <%= `echo $USER`.chomp %> | |
| password: | |
| database: <%= File.basename(Rails.root) %>_development | |
| test: |
| jQuery(document).ready(function() { | |
| /* | |
| Snippet from http://stackoverflow.com/a/5918791 | |
| */ | |
| navigator.sayswho = (function(){ | |
| var N= navigator.appName, ua= navigator.userAgent, tem; | |
| var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i); | |
| if(M && (tem= ua.match(/version\/([\.\d]+)/i))!= null) M[2]= tem[1]; |
This collection of files serves as a simple static demonstration of how to post to a google spreadsheet from an external html <form> following the example by Martin Hawksey
You should be able to just open index.html in your browser and test locally.
However if there are some permissions errors you can make a quick html server with python. Open terminal and cd to the directory where the gist files are located and enter python -m SimpleHTTPServer. By default this creates a local server at localhost:8000
| // original from: http://mashe.hawksey.info/2014/07/google-sheets-as-a-database-insert-with-apps-script-using-postget-methods-with-ajax-example/ | |
| // original gist: https://gist.github.com/willpatera/ee41ae374d3c9839c2d6 | |
| function doGet(e){ | |
| return handleResponse(e); | |
| } | |
| // Enter sheet name where data is to be written below | |
| var SHEET_NAME = "Sheet1"; |