information on creating indexes and hooking into mongoid rake tasks
This commit is contained in:
parent
66b8afe0d6
commit
87c771b96e
@ -1,10 +1,12 @@
|
|||||||
NAME
|
NAME
|
||||||
----
|
----
|
||||||
mongoid-sequence
|
mongoid-sequence
|
||||||
|
mongoid-grid_fs
|
||||||
|
|
||||||
INSTALL
|
INSTALL
|
||||||
-------
|
-------
|
||||||
gem install mongoid-sequence
|
gem install mongoid-sequence
|
||||||
|
gem install mongoid-grid_fs
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
--------
|
--------
|
||||||
@ -33,3 +35,8 @@ DESCRIPTION
|
|||||||
-----------
|
-----------
|
||||||
mongoid_sequence is a pure mongoid sequence generator based on mongodb's
|
mongoid_sequence is a pure mongoid sequence generator based on mongodb's
|
||||||
increment operator
|
increment operator
|
||||||
|
|
||||||
|
GRIDFS
|
||||||
|
------
|
||||||
|
Be sure to create indexes for the GridFS collections with `rake db:mongoid:create_indexes`.
|
||||||
|
|
||||||
|
@ -51,6 +51,10 @@
|
|||||||
|
|
||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
require "cgi"
|
require "cgi"
|
||||||
|
|
||||||
|
if defined?(::Rails::Railtie)
|
||||||
|
require 'mongoid-grid_fs/railtie'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -134,9 +138,6 @@
|
|||||||
namespace.send(:const_set, :File, file_model)
|
namespace.send(:const_set, :File, file_model)
|
||||||
namespace.send(:const_set, :Chunk, chunk_model)
|
namespace.send(:const_set, :Chunk, chunk_model)
|
||||||
|
|
||||||
#at_exit{ file_model.create_indexes rescue nil }
|
|
||||||
#at_exit{ chunk_model.create_indexes rescue nil }
|
|
||||||
|
|
||||||
const_get(const)
|
const_get(const)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
18
lib/mongoid-grid_fs/railtie.rb
Normal file
18
lib/mongoid-grid_fs/railtie.rb
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
module Mongoid
|
||||||
|
class GridFS
|
||||||
|
class Railtie < ::Rails::Railtie
|
||||||
|
rake_tasks do
|
||||||
|
task 'db:mongoid:create_indexes' do
|
||||||
|
::Mongoid::GridFS::Fs::File.create_indexes
|
||||||
|
::Mongoid::GridFS::Fs::Chunk.create_indexes
|
||||||
|
end
|
||||||
|
|
||||||
|
task 'db:mongoid:remove_indexes' do
|
||||||
|
::Mongoid::GridFS::Fs::File.remove_indexes
|
||||||
|
::Mongoid::GridFS::Fs::Chunk.remove_indexes
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user