Skip to content
Browse files

Revert "Semi-working mongo db implementation"

This reverts commit cf1a132.
  • Loading branch information...
1 parent cf1a132 commit 749666b04143d60eac425be359fa3ffaa2ce24bc Thom Mahoney committed Nov 3, 2011
Showing with 34 additions and 62 deletions.
  1. +5 −5 Gemfile
  2. +0 −10 Gemfile.lock
  3. +1 −5 app/models/list.rb
  4. +5 −11 app/models/task.rb
  5. +1 −5 config/application.rb
  6. +22 −0 config/database.yml
  7. +0 −26 config/mongoid.yml
  8. 0 db/test.sqlite3
View
10 Gemfile
@@ -2,14 +2,12 @@ source 'http://rubygems.org'
gem 'rails', '3.0.9'
-gem 'mongoid', '~> 2.2'
-gem 'bson_ext', '~> 1.4'
-
gem 'simple_form', '1.5.1'
gem 'jquery-rails', '1.0.14'
platform :ruby do
- gem 'mysql2', '~> 0.2.7'
+ gem 'mysql2', '~> 0.2.7'
+ gem 'sqlite3'
gem 'unicorn'
end
@@ -22,9 +20,11 @@ platforms :jruby do
end
+
+
# Bundle gems for the local environment. Make sure to
# put test-only gems in this group so their generators
# and rake tasks are available in development mode:
group :development, :test do
- gem 'sqlite3'
+
end
View
10 Gemfile.lock
@@ -31,8 +31,6 @@ GEM
activesupport (3.0.9)
arel (2.0.10)
bouncy-castle-java (1.5.0146.1)
- bson (1.4.0)
- bson_ext (1.4.0)
builder (2.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
@@ -52,12 +50,6 @@ GEM
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
- mongo (1.4.0)
- bson (= 1.4.0)
- mongoid (2.2.4)
- activemodel (~> 3.0)
- mongo (~> 1.3)
- tzinfo (~> 0.3.22)
mysql2 (0.2.13)
polyglot (0.3.2)
rack (1.2.4)
@@ -106,12 +98,10 @@ PLATFORMS
DEPENDENCIES
activerecord-jdbc-adapter
- bson_ext (~> 1.4)
jdbc-mysql
jdbc-sqlite3
jquery-rails (= 1.0.14)
jruby-openssl
- mongoid (~> 2.2)
mysql2 (~> 0.2.7)
rails (= 3.0.9)
simple_form (= 1.5.1)
View
6 app/models/list.rb
@@ -1,8 +1,4 @@
-class List
- include Mongoid::Document
- field :name, type: String
- field :created_at, type: DateTime
- field :updated_at, type: DateTime
+class List < ActiveRecord::Base
validates :name, :presence => true
validates_uniqueness_of :name, :on => :create, :message => "must be unique"
View
16 app/models/task.rb
@@ -1,14 +1,8 @@
-class Task
- include Mongoid::Document
- field :name, type: String
- field :done, type: Boolean
- field :list_id, type: Integer
- field :created_at, type: DateTime
- field :updated_at, type: DateTime
+class Task < ActiveRecord::Base
+
+ belongs_to :list, :class_name => "List", :foreign_key => "list_id"
+
+ validates :name, :presence => true
- belongs_to :list, :class_name => "List", :foreign_key => "list_id"
-
- validates :name, :presence => true
-
end
View
6 config/application.rb
@@ -1,10 +1,6 @@
require File.expand_path('../boot', __FILE__)
-require "action_controller/railtie"
-require "action_mailer/railtie"
-require "active_resource/railtie"
-require "rails/test_unit/railtie"
-# require "sprockets/railtie" # Uncomment this line for Rails 3.1+
+require 'rails/all'
# If you have a Gemfile, require the gems listed there, including any gems
# you've limited to :test, :development, or :production.
View
22 config/database.yml
@@ -0,0 +1,22 @@
+# SQLite version 3.x
+# gem install sqlite3
+development:
+ adapter: sqlite3
+ database: db/development.sqlite3
+ pool: 5
+ timeout: 5000
+
+# Warning: The database defined as "test" will be erased and
+# re-generated from your development database when you run "rake".
+# Do not set this db to the same as development or production.
+test:
+ adapter: sqlite3
+ database: db/test.sqlite3
+ pool: 5
+ timeout: 5000
+
+production:
+ adapter: sqlite3
+ database: db/production.sqlite3
+ pool: 5
+ timeout: 5000
View
26 config/mongoid.yml
@@ -1,26 +0,0 @@
-development:
- host: staff.mongohq.com
- port: 10004
- username: mongo_thom
- password: mongo_thom
- database: ey_mongo_dev
-
-# test:
-# host: staff.mongohq.com
-# port: 10004
-# username: mongo_thom
-# password: mongo_thom
-# database: ey_mongo_test
-
-# set these environment variables on your prod server
-production:
- host: staff.mongohq.com
- port: 10036
- username: mongo_thom
- password: mongo_thom
- database: ey_mongo_prod
- # slaves:
- # - host: slave1.local
- # port: 27018
- # - host: slave2.local
- # port: 27019
View
0 db/test.sqlite3
No changes.

0 comments on commit 749666b

Please sign in to comment.
Something went wrong with that request. Please try again.