Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save alininja/3339932 to your computer and use it in GitHub Desktop.
Save alininja/3339932 to your computer and use it in GitHub Desktop.
Can't Globalize Spree::PaymentMethod
#db/migrate/20120501085533_create_translation_tables.rb
class CreateTranslationTables < ActiveRecord::Migration
def up
Spree::PaymentMethod.create_translation_table! :name => :string
Spree::Product.create_translation_table! :name => :string, :description => :text, :ingredients => :text
Spree::Taxon.create_translation_table! :name => :string
Spree::OptionType.create_translation_table! :presentation => :string
Spree::OptionValue.create_translation_table! :presentation => :string
Spree::ShippingMethod.create_translation_table! :name => :string
end
def down
Spree::PaymentMethod.drop_translation_table!
Spree::Product.drop_translation_table!
Spree::Taxon.drop_translation_table!
Spree::OptionType.drop_translation_table!
Spree::OptionValue.drop_translation_table!
Spree::ShippingMethod.drop_translation_table!
end
end
#app/models/spree/payment_method_decorator.rb
Spree::PaymentMethod.class_eval do
translates :name, :fallbacks_for_empty_translations => true
end
#db/project/spree/payment_methods.yml
bogus_dev:
name: Credit Card
description: Bogus payment gateway for development.
environment: development
active: true
type: Spree::Gateway::Bogus
#db/project/spree/payment_method/translations.yml
bogus_dev_en:
spree_payment_method: bogus_dev
locale: en
name: Credit Card
bogus_dev_ja:
spree_payment_method: bogus_dev
locale: ja
name: Credit Card TBD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment