From 370d27655ee1639a56065d81464d988fcb23c701 Mon Sep 17 00:00:00 2001 From: Adrian Short Date: Fri, 22 Feb 2013 11:26:12 +0000 Subject: [PATCH] Remove MongoMapper config from models --- app/models/feed.rb | 15 +-------------- app/models/post.rb | 13 ------------- app/models/user.rb | 8 -------- 3 files changed, 1 insertion(+), 35 deletions(-) diff --git a/app/models/feed.rb b/app/models/feed.rb index 2838749..f3dcf0e 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -1,18 +1,5 @@ class Feed - include MongoMapper::Document - - key :title, String, :default => "[New feed - hasn't been fetched yet]" - key :feed_url, String # The URL of the RSS feed, not the website that owns it - key :url, String # The URL of website. Called "link" in RSS 2.0 - key :description, String - key :guid, String # Atom id or RSS guid - key :generator, String - key :last_fetched, Time, :default => nil - timestamps! - - ensure_index :title - - many :posts, :dependent => :destroy + has_many :posts, :dependent => :destroy validates :title, :presence => true validates_format_of :feed_url, :with => URI::regexp(%w(http https)), :message => "must be a valid URL" diff --git a/app/models/post.rb b/app/models/post.rb index 3841336..f5799b4 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1,17 +1,4 @@ class Post - include MongoMapper::Document - - key :title, String - key :url, String - key :author, String - key :summary, String - key :content, String - key :published, Time - key :loc, Hash # { lng, lat } - timestamps! - - ensure_index [[:loc, '2d']] - belongs_to :feed EARTH_RADIUS_M = 6378000 diff --git a/app/models/user.rb b/app/models/user.rb index 4eeb5b4..27c786f 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,11 +1,4 @@ class User - include MongoMapper::Document - - key :email, String - key :crypted_password, String - key :salt, String - timestamps! - authenticates_with_sorcery! # attr_accessible :email, :password, :password_confirmation @@ -14,5 +7,4 @@ class User validates_uniqueness_of :email validates_length_of :password, :minimum => 3, :message => "password must be at least 3 characters long", :if => :password validates_confirmation_of :password, :message => "should match confirmation", :if => :password - end