なるようになるブログ

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

rails commit log流し読み(2014/11/01)

2014/11/01分のコミットです。

CHANGELOGへの追加はありませんでした。


Rename default_attributes to _default_attributes

activerecord/lib/active_record/core.rbactiverecord/lib/active_record/model_schema.rbの修正です。

default_attributesメソッド_default_attributesにリネームしています。

_default_attributesは内部APIなのですが、default_attributesだとユーザが同名のメソッドを定義した場合に問題が起きてしまうので、リネームしています。


Add masked authenticity token section, details on finder options, misc typos [ci skip]

rails guideのA Guide for Upgrading Ruby on Railsの修正です。

Authenticity TokensがMaskされた事の説明の追加、及び細かいタイポの修正等を行っています。


Treat strings greater than int max value as out of range

ActiveRecordの修正です。

findメソッドの引数に、int max valueより大きな値を渡した際に、エラーが起きずnilが返ってきてたのを、正しくエラーを返すよう修正しています。

Todo.find('9999999999999999999999999999999')
# ActiveRecord::RecordNotFound: Couldn't find Todo with an out of range value for 'id'

内部的に、RangeErrorが起きた際に、rescueしてRecordNotFoundをraiseし直してるので、ユーザ側に送信されるのはRecordNotFoundになるようです。


Honor public/private in ActionView::Helpers::Tags::Base#value

actionview/lib/action_view/helpers/tags/base.rbの修正です。

valueメソッド内でメソッド呼び出しにsendを使用していたのをpublic_sendに修正しています。

sendだとprivateメソッドも呼べてしまうからですねえ。


Use public_send for form tags

actionview/test/template/form_helper_test.rbの修正です。

上記public_sendの対応について、テストを追加しています。


Improve test of private properties of objects in form tags

actionview/test/template/form_helper_test.rbの修正です。

上記で追加されたテストをリファクタリングしています。


Tiny documentation improvements [ci skip]

ActiveJobのdocの修正です。

グラマーの修正、タイポの修正等を行っています。


Use the correct values for int max and min

activerecord/lib/active_record/type/integer.rbの修正です。

intの最大値/最小値の判定に誤りがあったのを修正しています。


- Changed redundant user of deliver to deliver_now

actionmailer/README.rdocの修正です。

deliverdeliver_nowに修正、及び適切な位置への改行の追加等を行っています。


Merge pull request #17305 from ziggythehamster/activerecord-connectionhandling-RAILS_ENV-without-rails

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

ActiveRecord::connectionhandlingRAILS_ENVの値を設定する際に、Railsが定義されてない場合、ENV["RAILS_ENV"]又はENV["RACK_ENV"] の値も参照するよう修正しています。


Merge pull request #17040 from clyfe/patch-1

rails guideのA Guide to Testing Rails Applicationsの修正です。

テストのサンプルコードにテストクラス名の記載が無かったのを修正しています。


Load test schema even if there are no migrations

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

load_schema_if_pending!メソッドで、migrationが無い場合にもschemaをロードするよう修正しています。


Don't modify the columns hash to set defaults from the attributes API

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

ユーザがattributes APIに指定したデフォルトの値を保持するよう修正しています。


Don't attempt to load the schema file in tests if none exists

activerecord/lib/active_record/migration.rbactiverecord/lib/active_record/tasks/database_tasks.rbの修正です。

schemaファイルのチェック処理を追加し、ファイルが無い場合は読み込み処理を行わないよう修正しています。


Added region sequencing of primary keys for Postgres.

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbの修正です。

PostgreSQLで、PKのsequenceを設定する際、設定する値が0の場合に処理をスキップするよう対応しています。

0の場合SQLエラーが発生してしまう為対応したようです。


fix set_pk_sequence and add a test for it.

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbactiverecord/test/cases/adapters/postgresql/schema_test.rbの修正です。

先に追加したPKのsequence処理に対して、テストを追加しています。


remove unused and untested API

activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rbの修正です。

先に追加したPKのsequence処理のうち、不要な処理を削除しています。


Fix break on generated html

rails guideのThe Asset Pipelineの修正です。

Upgrading from Old Versions of Railsの項で、改行がおかしくなってしまっている箇所があったのを修正しています。