なるようになるブログ

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

rails commit log流し読み(2014/07/19)

2014/07/19分のコミットです。

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

actionpack/CHANGELOG.md

activerecord/CHANGELOG.md

create_join_table uses same logic as HABTM reflections


Modified migration conflict message to remove the string concatenation.

railties/lib/rails/generators/actions/create_migration.rbの修正です。

migrationがconflictした際のエラーメッセージからStringの連結を削除しています。

-            raise Error, "Another migration is already named #{migration_file_name}: " +
-                         "#{existing_migration}. Use --force to replace this migration" +
-                         " or --skip to ignore conflicted file."
+            raise Error, "Another migration is already named #{migration_file_name}: " \
+              "#{existing_migration}. Use --force to replace this migration " \
+              "or --skip to ignore conflicted file."

一つのStringとして扱うようにしているんですね。


create_join_table uses same logic as HABTM reflections

ActiveRecordcreate_join_tableの修正です。

joinするテーブルに共通のprefixがあった場合に、HABTM reflectionsと同様に削除するよう修正しています。

class CreateJoinTableTodoPost < ActiveRecord::Migration
  def change
    create_join_table :user_todos, :user_posts do |t|
    end
  end
end

上記のようなマイグレーションファイルがあった場合に、生成されるスキーマが以下のように変更になっています。

# before
create_table "user_posts_user_todos", id: false, force: true do |t|
  t.integer "user_todo_id", null: false
  t.integer "user_post_id", null: false
end

# after
create_table "user_posts_todos", id: false, force: true do |t|
  t.integer "user_todo_id", null: false
  t.integer "user_post_id", null: false
end

LOCALHOST definition should match any 127.0.0.0/8 address

actionpack/lib/action_dispatch/http/request.rbの修正です。

127.0.0.0/8のアドレスについても、ActionDispatch::Request::LOCALHOSTにマッチするよう修正しています。


Add CHANGELOG for #14886

上記LOCALHOSTの修正についてCHANGELOGに追記しています。


Merge pull request #16098 from tgxworld/fixes_to_request_test

actionpack/test/dispatch/request_test.rbの修正です。

テスト対象のHTTPメソッドをハードコーディングしていたのをActionDispatch::Request::HTTP_METHODSを使用するよう修正しています。


small refactors to actionview renderers

actionviewのrender処理のリファクタリングです。

メソッド名を修正したり、変数の代入処理の順番を調整したり、等々。


marking private methods which dont work if called on their own anyways

こちらもactionviewのrender処理のリファクタリングです。

外部から呼ばれていいないメソッドをprivateに修正しています。


adding missing test coverage

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

幾つかテストを追加しています。テストカバレッジ向上の為のようです。


Fixed typo in comment

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

typoを修正しています。