なるようになるブログ

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

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

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

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

actionview/CHANGELOG.md


Merge pull request #16089 from eileencodes/refactor-reflections-from-sub-classes-to-delegates

ActiveRecordのreflectionのリファクタリングです。

reflection処理用の基底クラスとしてAbstractReflectionクラスを作成し、処理を整理しています。


[CI SKIP] Doc fix.

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

"1+N"になってたのを"N+1"に修正したりと、docの細かい修正です。


Log digest as :debug instead of :info

actionview/lib/action_view/digestor.rbの修正です。

digestメソッドで行っているログ出力処理のログレベルをinfoからdebugに修正しています。


Return an absolute instead of relative path from an asset url in the case of the asset_host proc returning nil

actionview/lib/action_view/helpers/asset_url_helper.rbcompute_asset_hostメソッドの修正です。

asset_host procがnilを返すとき、asset_urlメソッドnilを返すバグを修正しています。


Merge pull request #16142 from andreychernih/extend-server-options

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

options解析処理にoption_parserメソッドを追加しています。

このメソッドを上書きする事で、独自のオプションをrails serverコマンドに指定出来るようになります。

PRにある例は以下。

require 'rails/commands/server'
module Rails
  class Server < ::Rack::Server
    class Options
      def option_parser_with_open(options)
        parser = option_parser_without_open options
        parser.on('-o', '--open', 'Open in default browser') { options[:open] = true }
        parser
      end
      alias_method_chain :option_parser, :open
    end

    def start_with_open
      start_without_open do
        `open http://localhost:3000` if options[:open]
      end
    end
    alias_method_chain :start, :open
  end
end

この例だと、ブラウザ起動用の-oオプションを追加しています。 これ色々出来そうで良いですねえ。