Permalink
Browse files

Adjust how example app environment is set up.

  • Loading branch information...
1 parent 9abec6c commit a58f1a19d3227e8712572bfbbabb31a362c25e46 @jcoglan jcoglan committed Oct 25, 2012
Showing with 14 additions and 19 deletions.
  1. +7 −7 example/environment.rb
  2. +4 −4 example/models/connection.rb
  3. +3 −8 example/schema.rb
View
@@ -1,12 +1,12 @@
-dir = File.expand_path('..', __FILE__)
-$:.unshift(dir + '/../lib')
-$:.unshift(dir)
-
+require 'rubygems'
require 'bundler/setup'
+
+require 'active_record'
require 'songkick/oauth2/provider'
Songkick::OAuth2::Provider.realm = 'Notes App'
-require 'models/connection'
-require 'models/user'
-require 'models/note'
+dir = File.expand_path('..', __FILE__)
+require dir + '/models/connection'
+require dir + '/models/user'
+require dir + '/models/note'
@@ -1,9 +1,9 @@
-require 'rubygems'
-require 'active_record'
+require 'fileutils'
-dir = File.expand_path(File.dirname(__FILE__))
+dbfile = File.expand_path('../../db/notes.sqlite3', __FILE__)
+FileUtils.mkdir_p(File.dirname(dbfile))
ActiveRecord::Base.establish_connection(
:adapter => 'sqlite3',
- :database => dir + '/../db/notes.sqlite3')
+ :database => dbfile)
View
@@ -1,14 +1,9 @@
-dir = File.expand_path('..', __FILE__)
-$:.unshift(dir + '/../lib')
-
require 'rubygems'
require 'bundler/setup'
-require 'songkick/oauth2/provider'
-require 'fileutils'
-require dir + '/models/connection'
-
-FileUtils.mkdir_p(dir + '/db')
+require 'songkick/oauth2/provider'
+require 'active_record'
+require File.expand_path('../models/connection', __FILE__)
ActiveRecord::Schema.define do |version|
create_table :users, :force => true do |t|

0 comments on commit a58f1a1

Please sign in to comment.