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
royw-macbook:tmp royw$ cat search_indexing.rb | |
require 'mongomapper' | |
require 'spec' | |
MongoMapper.connection = XGen::Mongo::Driver::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Person | |
include MongoMapper::Document | |
key :title, String |
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
require 'mongo_mapper' | |
require 'spec' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Cast | |
include MongoMapper::EmbeddedDocument | |
key :person, Integer | |
key :name, String |
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
require 'mongo_mapper' | |
require 'spec' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Test | |
include MongoMapper::Document | |
key :first, Integer | |
key :second, Integer |
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
require 'mongo_mapper' | |
require 'spec' | |
require 'log4r' | |
require 'versionomy' | |
# Logger used for logging MongoDB database commands | |
Log4r::Logger.new('TMP') | |
Log4r::Logger['TMP'].outputters = Log4r::StdoutOutputter.new(:console) | |
Log4r::Outputter[:console].formatter = Log4r::PatternFormatter.new(:pattern => "%m") | |
Log4r::Logger['TMP'].level = Log4r::DEBUG |
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
require 'mongo_mapper' | |
require 'spec' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Book | |
include MongoMapper::Document | |
key :title, String | |
key :_keywords, Array, :index => true |
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
require 'mongo_mapper' | |
require 'spec' | |
require 'extlib' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Bar | |
include MongoMapper::EmbeddedDocument | |
key :title, String |
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
require 'mongo_mapper' | |
require 'spec' | |
MongoMapper.connection = Mongo::Connection.new('localhost') | |
MongoMapper.database = 'tmp' | |
class Cast | |
include MongoMapper::EmbeddedDocument | |
key :person, Integer | |
key :name, String |
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
require 'spec' | |
require 'dm-core' | |
require 'dm-validations' | |
require 'dm-timestamps' | |
require 'dm-types' | |
require 'dm-aggregates' | |
DataMapper.setup(:default, 'mysql://localhost/test') | |
# DataMapper.setup(:default, 'sqlite3::memory:') |
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
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'data_mapper' | |
require 'extlib' | |
require 'pp' | |
require 'rspec' | |
# If you want the logs displayed you have to do this before the call to setup | |
DataMapper::Logger.new($stdout, :debug) |
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
# This gist originally showed the problem where I was not seeing the pagination navigation controls. | |
# This gist now shows how to correctly use pagination navigation controls. | |
# Thank you Yorick! | |
# Ramaze thread: http://groups.google.com/group/ramaze/browse_thread/thread/b40c827dce8d6ec1 | |
##### | |
# controller/init.rb: | |
class Controller < Ramaze::Controller | |
layout :default | |
helper :xhtml, :paginate, :gestalt |