now working with Rails 3.0 and the last Mongoid gem

This commit is contained in:
dinedine 2010-09-01 16:26:00 +02:00
parent c347038869
commit f7cfcf450e
4 changed files with 83 additions and 72 deletions

10
Gemfile
View File

@ -1,18 +1,17 @@
# Edit this Gemfile to bundle your application's dependencies.
source 'http://rubygems.org'
gem 'rails', '3.0.0.rc'
gem 'rails', '3.0.0'
# gem 'liquid', :path => '../gems/liquid' # local
gem 'liquid', :git => 'git://github.com/locomotivecms/liquid.git', :ref => 'b03cdc289ac36c339545'
gem 'bson_ext', '1.0.4'
gem 'mongoid', '2.0.0.beta.16'
gem 'bson_ext', '= 1.0.4'
gem 'mongoid', '2.0.0.beta.17'
gem 'mongoid_acts_as_tree', '0.1.5'
gem 'mongo_session_store', '2.0.0.pre'
gem 'warden'
gem 'devise', '1.1.2' #:git => 'git://github.com/plataformatec/devise.git'
gem 'haml', '3.0.15'
gem 'haml', '3.0.18'
gem 'rmagick', '2.12.2'
gem 'aws'
gem 'mimetype-fu', :require => 'mimetype_fu'
@ -43,7 +42,6 @@ group :test do
gem 'growl-glue'
gem 'rspec-rails', '2.0.0.beta.19'
gem 'factory_girl_rails'
# gem 'pickle', :git => 'http://github.com/codegram/pickle.git'
gem 'pickle', :git => 'http://github.com/ianwhite/pickle.git'
gem 'pickle-mongoid'
gem 'capybara'

View File

@ -7,9 +7,9 @@ GIT
GIT
remote: git://github.com/locomotivecms/custom_fields.git
revision: d393307
revision: 89c4d7d
specs:
custom_fields (0.0.0.1)
custom_fields (0.0.0.2)
GIT
remote: git://github.com/locomotivecms/liquid.git
@ -33,35 +33,35 @@ GEM
specs:
RedCloth (4.2.3)
abstract (1.0.0)
actionmailer (3.0.0.rc)
actionpack (= 3.0.0.rc)
actionmailer (3.0.0)
actionpack (= 3.0.0)
mail (~> 2.2.5)
actionmailer-with-request (0.1.1)
actionpack (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
actionpack (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.4.1)
rack (~> 1.2.1)
rack-mount (~> 0.6.9)
rack-mount (~> 0.6.12)
rack-test (~> 0.5.4)
tzinfo (~> 0.3.22)
activemodel (3.0.0.rc)
activesupport (= 3.0.0.rc)
tzinfo (~> 0.3.23)
activemodel (3.0.0)
activesupport (= 3.0.0)
builder (~> 2.1.2)
i18n (~> 0.4.1)
activerecord (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
arel (~> 0.4.0)
tzinfo (~> 0.3.22)
activeresource (3.0.0.rc)
activemodel (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
activesupport (3.0.0.rc)
arel (0.4.0)
activesupport (>= 3.0.0.beta)
activerecord (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
arel (~> 1.0.0)
tzinfo (~> 0.3.23)
activeresource (3.0.0)
activemodel (= 3.0.0)
activesupport (= 3.0.0)
activesupport (3.0.0)
arel (1.0.1)
activesupport (~> 3.0.0)
autotest (4.3.2)
aws (2.3.20)
http_connection
@ -117,7 +117,7 @@ GEM
trollop (~> 1.16.2)
git (1.2.5)
growl-glue (1.0.7)
haml (3.0.15)
haml (3.0.18)
has_scope (0.5.0)
heroku (1.9.14)
json_pure (>= 1.2.0, < 1.5.0)
@ -149,11 +149,11 @@ GEM
bson (>= 1.0.4)
mongo_session_store (2.0.0.pre)
actionpack (~> 3.0)
mongoid (2.0.0.beta.16)
activemodel (= 3.0.0.rc)
mongoid (2.0.0.beta.17)
activemodel (~> 3.0.0)
bson (= 1.0.4)
mongo (= 1.0.7)
tzinfo (= 0.3.22)
tzinfo (~> 0.3.22)
will_paginate (~> 3.0.pre)
mongoid_acts_as_tree (0.1.5)
bson (>= 0.20.1)
@ -173,18 +173,18 @@ GEM
rack (>= 1.0.0)
rack-test (0.5.4)
rack (>= 1.0)
rails (3.0.0.rc)
actionmailer (= 3.0.0.rc)
actionpack (= 3.0.0.rc)
activerecord (= 3.0.0.rc)
activeresource (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
bundler (>= 1.0.0.rc.1)
railties (= 3.0.0.rc)
railties (3.0.0.rc)
actionpack (= 3.0.0.rc)
activesupport (= 3.0.0.rc)
rake (>= 0.8.3)
rails (3.0.0)
actionmailer (= 3.0.0)
actionpack (= 3.0.0)
activerecord (= 3.0.0)
activeresource (= 3.0.0)
activesupport (= 3.0.0)
bundler (~> 1.0.0)
railties (= 3.0.0)
railties (3.0.0)
actionpack (= 3.0.0)
activesupport (= 3.0.0)
rake (>= 0.8.4)
thor (~> 0.14.0)
rake (0.8.7)
responders (0.6.2)
@ -220,7 +220,7 @@ GEM
treetop (1.4.8)
polyglot (>= 0.3.1)
trollop (1.16.2)
tzinfo (0.3.22)
tzinfo (0.3.23)
uuidtools (2.1.1)
warden (0.10.7)
rack (>= 1.0.0)
@ -253,7 +253,7 @@ DEPENDENCIES
fastthread
formtastic-rails3 (= 1.0.0.beta3)
growl-glue
haml (= 3.0.15)
haml (= 3.0.18)
heroku
httparty (= 0.6.1)
inherited_resources (= 1.1.2)
@ -263,12 +263,12 @@ DEPENDENCIES
mimetype-fu
mocha!
mongo_session_store (= 2.0.0.pre)
mongoid (= 2.0.0.beta.16)
mongoid (= 2.0.0.beta.17)
mongoid_acts_as_tree (= 0.1.5)
mongrel
pickle!
pickle-mongoid
rails (= 3.0.0.rc)
rails (= 3.0.0)
rmagick (= 2.12.2)
rspec-rails (= 2.0.0.beta.19)
ruby-debug

View File

@ -16,6 +16,19 @@ module Mongoid #:nodoc:
end
end
module Mongoid #:nodoc:
module Validations #:nodoc:
class AssociatedValidator < ActiveModel::EachValidator
def validate_each(document, attribute, value)
values = value.is_a?(Array) ? value : [ value ]
return if values.collect { |doc| doc.nil? || doc.valid? }.all?
document.errors.add(attribute, :invalid, options.merge(:value => value)) # was causing "can't modify frozen hash"
end
end
end
end
# http://github.com/emk/mongoid/blob/503e346b1b7b250d682a12332ad9d5872f1575e6/lib/mongoid/atomicity.rb
module Mongoid #:nodoc:
module Atomicity #:nodoc: