なるようになるブログ

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

rails commit log流し読み(2015/01/07)

2015/01/07分のコミットです。

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

actionmailer/CHANGELOG.md


Add mailer suffix to generated files and classes

ActionMailerのgeneratorの修正です。

generatorでmailerを生成する際、_mailerサフィックスを自動で付与するよう修正しています。

$ ./bin/rails d mailer user

# app/mailers/user_mailer.rb
class UserMailer < ApplicationMailer

  # Subject can be set in your I18n file at config/locales/en.yml
  # with the following lookup:
  #
  #   en.user.welcome.subject
  #
  def welcome
    @greeting = "Hi"

    mail to: "to@example.org"
  end
end

controller、jobと同じですね。

因みに、"_mailer"が付与されるのはmailerファイルだけで、viewの方には付与されません。

$ ./bin/rails g mailer User welcome
   identical  app/mailers/user_mailer.rb
   identical  app/mailers/application_mailer.rb
      invoke  erb
      create    app/views/user
   identical    app/views/layouts/mailer.text.erb
   identical    app/views/layouts/mailer.html.erb
      create    app/views/user/welcome.text.erb
      create    app/views/user/welcome.html.erb
      invoke  test_unit
      create    test/mailers/user_mailer_test.rb
      create    test/mailers/previews/user_mailer_preview.rb

これ不味い気が…。


fix attribute method scoping(i.e. private)

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

attributeのscopeにprivateに修正しています。


Changing sets -> set

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

cookie_jarメソッドのdomainオプションの説明内の"sets" -> "set"に修正しています。


Use Ruby's #include? to avoid relying on AS extension

activesupport/lib/active_support/core_ext/date_and_time/calculations.rbの修正です。

on_weekend?メソッドActiveSupportの拡張であるin?メソッドを使用していたのを、Ruby標準のinclude?メソッドを使用するよう修正しています。


acronyms like ORM should be in uppercase, so overwrite the desc generated by hook_for

railties/lib/rails/generators/rails/migration/migration_generator.rbrailties/lib/rails/generators/rails/model/model_generator.rbの修正です。

ormのhookについて、descオプションを追加ししています。

-      hook_for :orm, required: true
+      hook_for :orm, required: true, desc: "ORM to be invoked"

generatorで表示されるヘルプの表示の修正の為ですかね。

# before
-o, --orm=NAME                                 # Orm to be invoked

# after
-o, --orm=NAME                                 # ORM to be invoked

Move changelog entry to the top [ci skip]

actionmailer/CHANGELOG.mdの修正です。

CHANGELOの順番をコミットされた順に修正しています。