Change to MongoDB
This commit is contained in:
1 parent
fd8f9cace5
commit
b17ebfb9b7
8 files changed
+55
-44
No files matched your search
+18
-15
@@ -21,6 +21,7 @@ Rails::Initializer.run do |config|
|
||||
# config.gem "aws-s3", :lib => "aws/s3"
|
||||
|
||||
config.gem "liquid"
|
||||
config.gem "mongo_mapper"
|
||||
|
||||
# Only load the plugins named here, in the order given (default is alphabetical).
|
||||
# :all can be used as a placeholder for all plugins not explicitly named
|
||||
@@ -39,26 +40,28 @@ Rails::Initializer.run do |config|
|
||||
|
||||
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
||||
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}')]
|
||||
config.i18n.default_locale = "zh_tw"
|
||||
config.i18n.default_locale = "en"
|
||||
|
||||
end
|
||||
|
||||
#VALID_LOCALES = ["en", "zh_tw"]
|
||||
VALID_LOCALES = ["en", "zh_tw"]
|
||||
require 'couch_foo'
|
||||
CouchFoo::Base.set_database(:host => "http://localhost:5984", :database => "r4")
|
||||
|
||||
class CouchFoo::Base
|
||||
|
||||
def self.property_i18n(property_name, property_type)
|
||||
VALID_LOCALES.each do |locale|
|
||||
property "#{property_name.to_s}_#{locale}".to_sym, property_type
|
||||
end
|
||||
|
||||
define_method( property_name ) do
|
||||
self.read_attribute("#{property_name.to_s}_#{I18n.locale}")
|
||||
end
|
||||
end
|
||||
MongoMapper.database = "r4-#{Rails.env}"
|
||||
|
||||
end
|
||||
|
||||
#class CouchFoo::Base
|
||||
#
|
||||
# def self.property_i18n(property_name, property_type)
|
||||
# VALID_LOCALES.each do |locale|
|
||||
# property "#{property_name.to_s}_#{locale}".to_sym, property_type
|
||||
# end
|
||||
#
|
||||
# define_method( property_name ) do
|
||||
# self.read_attribute("#{property_name.to_s}_#{I18n.locale}")
|
||||
# end
|
||||
# end
|
||||
#
|
||||
#end
|
||||
|
||||
|
||||
Reference in new issue
Block a user