Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ckhrysze/1349636 to your computer and use it in GitHub Desktop.
Save ckhrysze/1349636 to your computer and use it in GitHub Desktop.
A Rails Template for using MongoMapper
# mongo_template.rb
# fork of Ben Scofield's Rails MongoMapper Template (http://gist.github.com/181842)
# add basic layout to start
file 'app/views/layouts/application.html.erb', <<HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Application!</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" type="text/javascript"></script>
<%= stylesheet_link_tag 'global' %>
</head>
<body>
<%= yield %>
</body>
</html>
HTML
# MongoDB FTW!
db_name = ask('What should I call the database? ')
initializer 'database.rb', <<-CODE
MongoMapper.database = "#{db_name}-\#{Rails.env}"
CODE
file 'config/database.yml', <<-CODE
# Using MongoDB
CODE
# Don't need ActiveRecord
environment 'config.frameworks -= [:active_record]'
# MongoMapper
gem 'mongo_mapper'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment