Created
February 25, 2010 11:39
-
-
Save julienXX/314473 to your computer and use it in GitHub Desktop.
Rails 3 & MongoMapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Paper | |
include MongoMapper::Document | |
key :url, String, :required => true | |
key :read, Boolean | |
key :archived, Boolean | |
key :screenshot, Binary | |
key :date, Date | |
many :tags | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MongoMapper.connection = Mongo::Connection.new('localhost', 27017) | |
MongoMapper.database = "#myapp-#{Rails.env}" | |
if defined?(PhusionPassenger) | |
PhusionPassenger.on_event(:starting_worker_process) do |forked| | |
MongoMapper.connection.connect_to_master if forked | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "mongo_ext" | |
gem "mongo_mapper", :git => 'http://github.com/merbjedi/mongomapper.git', :branch => 'rails3' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gem "mongo_ext" | |
gem "mongo_mapper-rails3", :require => "mongo_mapper" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ gem install i18n tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler | |
$ gem install rails --pre |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment