Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Contribution to Rails

naoty
March 27, 2015

Contribution to Rails

naoty

March 27, 2015
Tweet

More Decks by naoty

Other Decks in Programming

Transcript

  1. ίϯτϦϏϡʔτͷ࢓ํ • fork, checkout, push, pull req • มߋ఺ΛCHANGELOGʹ௥ه •

    mergeઌʹ஫ҙ!!! • master͸rails 5ܥ • ͙͢ʹϦϦʔε͍ͨ͠ͳΒ4-1-stable, 4-2-stable
  2. ྫ͑͹ # config/secrets.yml development: secret_key_base: aaaaaaaa facebook: app_id: bbbbbbbb app_secret:

    ccccccccc # rails c > Rails.application.secrets.secret_key_base #=> aaaaaaaa > Rails.application.secrets.facebook[:app_id] #=> bbbbbbbb facebook.app_id ͬͯॻ͖͍ͨ
  3. railties/lib/rails/ application.rb:386 def secrets @secrets ||= begin secrets = ActiveSupport::OrderedOptions.new

    yaml = config.paths["config/secrets"].first if File.exist?(yaml) require "erb" all_secrets = YAML.load(ERB.new(IO.read(yaml)).result) || {} env_secrets = all_secrets[Rails.env] secrets.merge!(env_secrets.symbolize_keys) if env_secrets end # Fallback to config.secret_key_base if secrets.secret_key_base isn't set secrets.secret_key_base ||= config.secret_key_base # Fallback to config.secret_token if secrets.secret_token isn't set secrets.secret_token ||= config.secret_token secrets end end
  4. railties/lib/rails/ application.rb:386 def secrets @secrets ||= begin secrets = ActiveSupport::OrderedOptions.new

    yaml = config.paths["config/secrets"].first if File.exist?(yaml) require "erb" all_secrets = YAML.load(ERB.new(IO.read(yaml)).result) || {} env_secrets = all_secrets[Rails.env] secrets.merge!(env_secrets.symbolize_keys) if env_secrets end # Fallback to config.secret_key_base if secrets.secret_key_base isn't set secrets.secret_key_base ||= config.secret_key_base # Fallback to config.secret_token if secrets.secret_token isn't set secrets.secret_token ||= config.secret_token secrets end end ϝιουͬΆ͘ΞΫηεͰ͖Δ΍ͭ
  5. railties/lib/rails/ application.rb:386 def secrets @secrets ||= begin secrets = ActiveSupport::OrderedOptions.new

    yaml = config.paths["config/secrets"].first if File.exist?(yaml) require "erb" all_secrets = YAML.load(ERB.new(IO.read(yaml)).result) || {} env_secrets = all_secrets[Rails.env] secrets.merge!(env_secrets.symbolize_keys) if env_secrets end # Fallback to config.secret_key_base if secrets.secret_key_base isn't set secrets.secret_key_base ||= config.secret_key_base # Fallback to config.secret_token if secrets.secret_token isn't set secrets.secret_token ||= config.secret_token secrets end end ͨͩͷHashΛmergeͯ͠ΔͬΆ͍ͷͰ ࠶ؼతʹAS::OrderedOptions࢖͑͹Αͦ͞͏