i18n_backend_database
Database Backend for Rails I18n
i18n_db_admin
Demo application including admin interface for Rails translations using i18n_db
| # 1) Point *.example.com in your DNS setup to your server. | |
| # | |
| # 2) Setup an Apache vhost to catch the star pointer: | |
| # | |
| # <VirtualHost *:80> | |
| # ServerName example.com | |
| # ServerAlias *.example.com | |
| # </VirtualHost> | |
| # | |
| # 3) Set the current account from the subdomain |
| MiniSite.copy_site_path_dir | |
| - creates destination directory automatically | |
| - copies 'mini_site/xx_XX/zzz' directory to 'mini_site/yy_YY/zzz' | |
| - allows to copy more than twice | |
| - removes old directory before copying (FAILED - 2) | |
| MiniSite.copy_dir | |
| /home/jan/workspaces/asics/public/system/mini_sites/y1_B1 | |
| tar: This does not look like a tar archive | |
| tar: Skipping to next header |
| #-------------------------------------------------- | |
| # ActiveMerchant Options | |
| # | |
| # :order_id - The order number. | |
| # :ip - The IP address of the customer making the purchase. | |
| # :customer - The name, customer number, or other information that identifies the customer. | |
| # :invoice - The invoice number. | |
| # :merchant - The name or description of the merchant offering the product. | |
| # :description - A description of the transaction. | |
| # :email - The email address of the customer. |
| class OrderTransaction < ActiveRecord::Base | |
| belongs_to :order | |
| serialize :params | |
| cattr_accessor :gateway | |
| class << self | |
| def authorize(amount, credit_card, options = {}) | |
| process('authorization', amount) do |gw| | |
| gw.authorize(amount, credit_card, options) | |
| end | |
| end |
| # application/moneyhats/config/environments/development.rb | |
| # We want to use the BraintreeGateway in test mode so | |
| # that we can simulate real transactions during development. The code | |
| # needs to be placed in the to_prepare block so that it is executed on | |
| # each reload of the OrderTransaction model in development mode. If | |
| # the code had been placed in the after_initialize block then Order- | |
| # Transaction.gateway would be properly set on the first request to the | |
| # application, but would be nil on all subsequent requests. | |
| config.after_initialize do |
| # application/moneyhats/test/test_helper.rb | |
| include ActiveMerchant::Billing | |
| # application/moneyhats/test/test_helper.rb | |
| def credit_card_hash(options = {}) | |
| { :number => '1', | |
| :first_name => 'Cody', | |
| :last_name => 'Fauser', | |
| :month => '8', | |
| :year => "#{ Time.now.year + 1 }", |
| # application/moneyhats/app/models/order.rb | |
| # pending - The initial order state. No successful or unsuccessful | |
| # payments have been attempted on the order. | |
| # authorized - A successful order authorization has been made. The | |
| # order is ready for fulfillment and payment capture. | |
| # paid - The authorized payment has been captured. | |
| # payment_declined - Authorization has been attempted, but failed. | |
| # The order can still be authorized in a subsequent | |
| # authorization attempt. |
| require 'fileutils' | |
| $cache_dir = File.join('tmp', 'watchr') | |
| FileUtils.mkdir_p($cache_dir) unless File.exist?($cache_dir) | |
| def modified?(file) | |
| cache_file = File.join $cache_dir, file | |
| `diff #{file} #{cache_file} >/dev/null 2>&1` | |
| if $? != 0 |
| # spec/helper/random_form_builder_spec.rb | |
| describe RandomFormBuilder do | |
| attr_reader :builder, :helper | |
| before do | |
| @helper = Object.extend(ActionView::Helpers::FormHelper) | |
| @object = stub_model(Random) | |
| @builder = RandomFormBuilder.new(:random, @object, @helper, {}, nil) | |
| end | |
| end |
i18n_backend_database
Database Backend for Rails I18n
i18n_db_admin
Demo application including admin interface for Rails translations using i18n_db