Browse Source

Remove MongoMapper config from models

master
Adrian Short 11 years ago
parent
commit
370d27655e
3 changed files with 1 additions and 35 deletions
  1. +1
    -14
      app/models/feed.rb
  2. +0
    -13
      app/models/post.rb
  3. +0
    -8
      app/models/user.rb

+ 1
- 14
app/models/feed.rb View File

@@ -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"


+ 0
- 13
app/models/post.rb View File

@@ -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


+ 0
- 8
app/models/user.rb View File

@@ -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

Loading…
Cancel
Save