なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2014/08/22)

2014/08/22分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

actionpack/CHANGELOG.md

activesupport/CHANGELOG.md

Add the Duration#instance_of? method that was previously delegated to the internal value attribute.


Make text consistent in help text of rails server and console commands.

railties/lib/rails/commands/console.rbrailties/lib/rails/commands/server.rbの修正です。

エラー時に出力するhelpのグラマー修正。


Guide fix. [CI SKIP]

guides/source/upgrading_ruby_on_rails.mdの修正です。

こちらもグラマーの修正です。


adding the exception RecordNotFound to UUID find

activerecord/lib/active_record/connection_adapters/postgresql/oid/uuid.rbの 修正です

Primar KeyにUUIDを指定した場合に、データが見つからなかった場合にfindメソッドRecordNotFoundをraiseするよう修正しています。


[ci skip] Added documentation for has_one scope parameter

activerecord/lib/active_record/associations.rbのdocの修正です。

has_one scopeにパラメータを渡すサンプルを追加しています。

has_one :auther, -> { where(comment_id: 1) }
has_one :employer, -> { joins(:company) }
has_one :dob, ->(dob) { where("Date.new(2000, 01, 01) > ?", dob) }

Add change to ActionView Notable changes [ci skip]

guides/source/4_2_release_notes.mdの修正です。

labelメソッドi18n対応が行われた件を追加しています。


Don't fight against ourselves for the default log level

railties/lib/rails/application/configuration.rbの修正です。

デフォルトのログ出力レベルが、productionの場合でも:debugになるよう変更されました。

def log_level
-   @log_level ||= Rails.env.production? ? :info : :debug
+   @log_level ||= :debug
end

以前DHHがコミットした件のフォローアップですね。productionでのログレベルをinfoにしたい場合は、configに明示的に指定してあげる必要があります。


applies API guidelines to new AM docs

ActionMailerのdocの修正です。

現行のAPIに合わせる形にdocを修正しています。


ActiveJob -> Active Job [ci skip]

ActivenJobのdocの修正です。"ActiveJob" -> "Active Job"に修正しています。


Refactor ActionDispatch::RemoteIp

actionpack/lib/action_dispatch/middleware/remote_ip.rbの修正です。

ActionDispatch::RemoteIpIPアドレスチェック処理のリファクタリング、及びproxyに指定するIPをconfigに指定出来るよう修正しています。

configの設定方法は以下の通り

# config/environments/production.rb
config.action_dispatch.trusted_proxies = IPAddr.new('4.8.15.0/16')

Replacing an each with reduce

activemodel/lib/active_model/errors.rbの修正です。

to_hashメソッドリファクタリングです。eachメソッドの呼び出し回数を減らしています。


fix server names [ci skip]

railties/lib/rails/commands/server.rbの修正です。

Mongrel -> mongrelThin -> thinに修正しています。helpのエラーメッセージなのに、実際に指定する文字に戻しています。


fix grammar [ci skip]

railties/lib/rails/commands/console.rbの修正です。

Rollbacks -> Rollbackに修正。


Revert "Add I18n support for :placeholder HTML option is passed to form fields"

:placeholderi18nサポートを追加したコミットをrevertしています。

リグレッションが発生してしまっていたので、一旦revertしたようです。

リグレッションに対応したPRが再度作られているようなので、後でまたコミットされますかねえ。


[ci skip] Added documentation for has_and_belongs_to_many scope parameter

activerecord/lib/active_record/associations.rbのdocの修正です。

has_and_belongs_to_many scopeにパラメータ指定した場合のサンプル追加しています。

has_and_belongs_to_many :projects, -> { includes :milestones, :manager }
has_and_belongs_to_many :categories, ->(category) {
  where("default_category = ?", category.name)
}

[ci skip] Running AR tests guide [Fixes GH-15891]

activerecord/RUNNING_UNIT_TESTS.rdocの修正です。

グラマーの修正です。


Follow up on #16408

guides/source/generators.mdの修正です。

generatorで生成されるサンプルについての説明を修正しています。


add nested_model_forms to guides/documents.yaml [wip] [ci skip]

guides/source/nested_model_forms.mdの修正です。

associationsについての注記を追加しています。


Pass logging message through block.

activejob/lib/active_job/logging.rbの修正です。

ロギング処理をブロックでおおうよう修正しています。


Missing space. [CI SKIP]

guides/source/debugging_rails_applications.mdの修正です。

スペースを追加しています。


Using each_with_object instead of reduce

activemodel/lib/active_model/errors.rbの修正です。

繰り返し処理にreduceメソッドを使用していたのをeach_with_objectを使用するよう修正しています。

-        self.messages.reduce({}) do |messages, (attribute, array)|
-          messages.merge!(attribute => array.map { |message| full_message(attribute, message) })
+        self.messages.each_with_object({}) do |(attribute, array), messages|
+          messages[attribute] = array.map { |message| full_message(attribute, message) }

Merge pull request #16560 from robin850/rbx-duration-eql

activesupport/lib/active_support/duration.rbの修正です。

Duration#instance_of?メソッドを追加しています。

Duration#is_a?メソッド内部で行っていた処理をメソッドに切り出した形です。nodocになっているので、一応内部API用の扱いのようです。


Implemented enqueue_at for ActiveJob's Backburner adapter

activejob/lib/active_job/queue_adapters/backburner_adapter.rbの修正です。

Backburner adapterにenqueue_atメソッドを実装しています。


Active Job guide: Add info about queue_name prefix and clarity supporter features

guides/source/active_job_basics.mdの修正です。

queue_nam prefixについての説明を追加しています。