View example.html
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
<div id="floatingbar"> | |
<ul> | |
<li><a href="#" onClick="CollapsibleLists.expand(true)">Expand All</a></li> | |
<li><a href="#" onClick="CollapsibleLists.expand(false)">Collapse All</a></li> | |
</ul> | |
</div> |
View home_spec.rb
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_helper' | |
# abridged | |
feature "Home Page" do | |
background do | |
@session.header 'Accept', 'text/html' | |
end | |
scenario 'Accessing the home page' do | |
visit('/') |
View gist:1812150
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 |
View gist:1260479
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) |
View gist:231789
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:') |
View embedded_documents.rb
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 |
View gist:216763
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 |
View gist:213584
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 |
View mongomapper $where examples
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 |
View gist:205303
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 |
NewerOlder