Skip to content

Instantly share code, notes, and snippets.

# This is an incomplete implementation.
module MongoMapper
module NestedAttributes
def self.included(base)
base.extend(ClassMethods)
base.send :include, InstanceMethods
end
module ClassMethods
def accepts_nested_attributes_for(*attr_names)
module Paperclip
class << self
def logger #:nodoc:
MongoMapper.logger
end
end
module ClassMethods
def has_attached_file name, options = {}
include InstanceMethods
/usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/source.rb:552:in `load_spec_files': git://github.com/bhbryant/aasm.git (at master) is not checked out. Please run `bundle install` (Bundler::PathError)
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/source.rb:371:in `local_specs'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/source.rb:534:in `specs'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/lazy_specification.rb:48:in `__materialize__'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/spec_set.rb:83:in `materialize'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/spec_set.rb:81:in `map!'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/spec_set.rb:81:in `materialize'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.rc.2/lib/bundler/definition.rb:93:in `specs'
from /usr/ruby1.8.7/lib/ruby/gems/1.8/gems/bundler-1.0.0.r
@bhbryant
bhbryant / retry.rb
Created September 21, 2011 01:19
auto-failover ReplicaSet config for MongoMapper, by way of ruby driver
replica_sets = mm_env['replica_sets'] # node1:port&node2:port
rs_list = replica_sets.split("&").map {|rs| host,port = rs.split(":"); [host,port.to_i] }
MongoMapper.connection = Mongo::RetryReplicaSetConnection.new(*(rs_list << {:read_secondary => true, :auto_refresh => true }))
MongoMapper.database = mm_env['database']
MongoMapper.database.authenticate(mm_env['username'], mm_env['password'])