最終更新日:2013/2/23
現在最新のRuby on Rails 4.0.3をherokuで公開するための設定を記載します。 大きく、2つの項目で構成されます。
- 0からのセットアップ
| require 'active_merchant' | |
| require 'pp' | |
| currency = 'USD' | |
| gateway = ActiveMerchant::Billing::WorldpayGateway.new( | |
| :login => 'YOUR_MERCHANT_ID', | |
| :password => 'YOUR_XML_PASSWORD', | |
| :test => true, | |
| ) |
| unless Settings.activemerchant.proxy.host.blank? | |
| module ActiveMerchant | |
| class Connection | |
| alias_method :http_original, :http | |
| private | |
| def http | |
| proxy = Settings.activemerchant.proxy | |
| http = Net::HTTP.new(endpoint.host, endpoint.port, proxy.host, proxy.port) |
| <!doctype html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Stripe JS Sample Page</title> | |
| <meta name="author" content="Yuki Matsukura"> | |
| </head> | |
| <body> |
| class << Time | |
| alias_method :now_original, :now | |
| def now | |
| puts 'override' | |
| end | |
| end | |
| puts Time.now | |
| puts Time.now_original |
| module ActiveRecord | |
| module Querying | |
| delegate :group_date, :to => :scoped | |
| end | |
| module QueryMethods | |
| def group_date(column_name = nil) | |
| return self if column_name.blank? | |
| # Rails uses a non standard time zone naming. |
| $redis.keys.map {|key| p Marshal::load($redis.get(key)) } |
| diff --git a/composer.json b/composer.json | |
| index 239a542..c697dad 100644 | |
| --- a/composer.json | |
| +++ b/composer.json | |
| @@ -1,5 +1,6 @@ | |
| { | |
| "require": { | |
| + "php": ">=5.4.0", | |
| "curl/curl": "dev-master", | |
| "phpunit/phpunit": "4.1.*", |
| <!doctype html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Sample Page</title> | |
| <meta name="author" content="Yuki Matsukura"> | |
| </head> | |
| <body> | |
| <form> |
| <!doctype html> | |
| <html lang="ja"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <title>Sample Page</title> | |
| <meta name="author" content="Yuki Matsukura"> | |
| </head> | |
| <body> | |
| <form> |