@@ -1,18 +1,5 @@ | |||||
class Feed | 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 :title, :presence => true | ||||
validates_format_of :feed_url, :with => URI::regexp(%w(http https)), :message => "must be a valid URL" | validates_format_of :feed_url, :with => URI::regexp(%w(http https)), :message => "must be a valid URL" | ||||
@@ -1,17 +1,4 @@ | |||||
class Post | 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 | belongs_to :feed | ||||
EARTH_RADIUS_M = 6378000 | EARTH_RADIUS_M = 6378000 | ||||
@@ -1,11 +1,4 @@ | |||||
class User | class User | ||||
include MongoMapper::Document | |||||
key :email, String | |||||
key :crypted_password, String | |||||
key :salt, String | |||||
timestamps! | |||||
authenticates_with_sorcery! | authenticates_with_sorcery! | ||||
# attr_accessible :email, :password, :password_confirmation | # attr_accessible :email, :password, :password_confirmation | ||||
@@ -14,5 +7,4 @@ class User | |||||
validates_uniqueness_of :email | validates_uniqueness_of :email | ||||
validates_length_of :password, :minimum => 3, :message => "password must be at least 3 characters long", :if => :password | 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 | validates_confirmation_of :password, :message => "should match confirmation", :if => :password | ||||
end | end |