From b89d6f2dbd436ada4592321b3bbe5b453c97ee8f Mon Sep 17 00:00:00 2001 From: did Date: Wed, 14 Sep 2011 16:37:20 +0200 Subject: [PATCH] enable i18n for the category custom type --- lib/locomotive.rb | 2 +- lib/locomotive/custom_fields.rb | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/locomotive.rb b/lib/locomotive.rb index c168db84..bae5f394 100644 --- a/lib/locomotive.rb +++ b/lib/locomotive.rb @@ -9,6 +9,7 @@ require 'locomotive/dragonfly' require 'locomotive/liquid' require 'locomotive/mongoid' require 'locomotive/carrierwave' +require 'locomotive/i18n' require 'locomotive/custom_fields' require 'locomotive/httparty' require 'locomotive/inherited_resources' @@ -22,7 +23,6 @@ require 'locomotive/delayed_job' require 'locomotive/middlewares' require 'locomotive/session_store' require 'locomotive/hosting' -require 'locomotive/i18n' module Locomotive diff --git a/lib/locomotive/custom_fields.rb b/lib/locomotive/custom_fields.rb index 89da81da..c4963e00 100644 --- a/lib/locomotive/custom_fields.rb +++ b/lib/locomotive/custom_fields.rb @@ -23,6 +23,13 @@ module CustomFields module Category class Item + include Mongoid::I18n + + localized_fields :name, :position + + field :name + field :position, :type => Integer, :default => 0 + def to_liquid { 'id' => self._id.to_s, 'name' => self.name } end