Skip to content

Instantly share code, notes, and snippets.

@tsabat
Created February 16, 2012 06:12
Show Gist options
  • Save tsabat/1842581 to your computer and use it in GitHub Desktop.
Save tsabat/1842581 to your computer and use it in GitHub Desktop.
require 'mongo_mapper'
class Content
include MongoMapper::Document
attr_accessible :version, :html, :css, :js, :html_preprocessor, :css_preprocessor, :js_preprocesor
#Foreign Keys
key :user_id, String
key :slug_id, String
key :version, Integer
key :html, String
key :css, String
key :js, String
key :html_preprocessor, String
key :css_preprocessor, String
key :js_preprocesor, String
timestamps!
#TODO: validations
end
require 'mongo_mapper'
require_relative '../models/content'
class ContentService
def initialize(db = 'tinkerbox')
MongoMapper.database = db
end
def save_content(content)
begin
Content.new(content).save
rescue
#TODO: handle exceptions
throw "Fuck!"
end
end
end
@quezo
Copy link

quezo commented Feb 16, 2012

    name              : '',
    html              : '',
    css               : '',
    js                : '',
    version           : 1,
    htmlPreProcessor  : 'none',

    cssPreProcessor   : 'none',
    cssPreFixFree     : '',

    jsPreProcessor    : 'none',
    jsLibrary         : '',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment