Last active
June 4, 2017 11:27
-
-
Save sushant12/f88d90993e502f645b0cf0f92eeb0340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'active_record' | |
require 'pg' | |
require 'sinatra' | |
ActiveRecord::Base.establish_connection( | |
adapter: 'postgresql', | |
host: 'localhost', | |
username: 'postgres', | |
password: 'postgres', | |
database: 'testdb' | |
) | |
class Task < ActiveRecord::Base | |
validates :name, presence: true | |
end | |
get '/' do | |
@tasks = Task.all | |
erb :index | |
# erb :index, locals: {tasks: Task.all} | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment