ローカルのomniauth.ymlにheroku用の設定を書いておいて、
$ rake heroku_config:upload
すればherokuに設定がコピーされます。
require 'drb' | |
require 'readline' | |
DRb.start_service | |
server = DRbObject.new_with_uri("druby://localhost:9898") | |
while buf = Readline.readline('> ', true) | |
buf = buf.strip | |
case buf | |
when 'exit' |
ローカルのomniauth.ymlにheroku用の設定を書いておいて、
$ rake heroku_config:upload
すればherokuに設定がコピーされます。
# この行を追加。デフォルトだと-fでCapfileを指定したときにエラーになる。 | |
Dir.chdir(File.dirname(__FILE__)) | |
load 'deploy' if respond_to?(:namespace) # cap2 differentiator | |
Dir['vendor/plugins/*/recipes/*.rb'].each { |plugin| load(plugin) } | |
load 'config/deploy' # remove this line to skip loading any of the default tasks |
#!/usr/bin/env ruby | |
APP_PATH = File.expand_path('../../config/application', __FILE__) | |
require File.expand_path('../../config/boot', __FILE__) | |
require 'rails/commands/console' | |
require APP_PATH | |
Rails.application.require_environment! | |
require "arproxy" | |
module Arproxy | |
class Readonly < Base |
describe "GET current" do | |
before do | |
@request.cookies['hidden_notices'] = "1,#{notices(:permanent).id}" | |
get :current, :format => 'js' | |
end | |
it { should respond_with(:success) } | |
it { should set_cookie(:hidden_notices).to("#{notices(:permanent).id}") } | |
it { should render_template('notices/current') } | |
end |
class ActionDispatch::Routing::Mapper | |
def draw(routes_name) | |
instance_eval(File.read(Rails.root.join("config/routes/#{routes_name}.rb"))) | |
end | |
end | |
BCX::Application.routes.draw do | |
draw :api | |
draw :account | |
draw :session |
# config/environments/production.rb | |
# We're on Heroku, just output straight to STDOUT | |
# This is required because we're using Unicorn: https://github.com/ryanb/cancan/issues/511#issuecomment-3643266 | |
config.logger = Logger.new(STDOUT) | |
config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO') |
[参考ページ] | |
blank? nil? zero?: Rails開発日記 | |
- [ http://underrails.seesaa.net/article/135698039.html ] | |
--------- | |
0.nil? #=> false | |
0.zero? #= true | |
0.empty? #=> NoMethodError |
◆例 | |
[ 0.001 * 100 ] : 0.1 | |
[ 0.58 * 100 ] : 57.99999999999999 | |
[ 0.58.to_d * 100 ] : #<BigDecimal:1017f2f68,'0.58E2',9(36)> | |
[ 0.58.class.name ] : "Float" | |
[ 0.58.to_d.class.name ] : "BigDecimal" | |
[ (0.58.to_d * 100).to_i ] : 58 |
◆アルファベット | |
('a'..'z').to_a | |
# => ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"] | |
('A'..'Z').to_a | |
# => ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"] | |
◆数値 | |
(1..20).to_a | |
# => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] |