after_create -> { Notification.create! comment: self, recipients: commentable.recipients } end module Copyable def copy_to(destination) Notification.suppress do # Copy logic that creates new comments that we do not want # triggering notifications. end end end
User.select(:name, :email) end end Processing by UsersController#index as HTML User Load (0.1ms) SELECT "users".* FROM "users" Rendered users/index.html.erb within layouts/application (1.0ms) ["name", "email"] গ͚ͩ͠ߴԽ
Ұ൪࠷ޙʹ%#Λϩʔυͨ͠FOWJSPONFOUͱɺআ͢Δ%#ͷFOWJSPONFOU͕ҟͳ ΔͱআͰ͖ͳ͍ w EFWFMPQNFOU༻ͷϚγϯͰQSPEVDUJPOͷ%#Λؒҧͬͯফ͢Έ͍ͨͳͷΛ੍ w %#আ͢ΔFOWJSPONFOUͰCJOSBJMTECFOWJSPONFOUTFUͱ͢Δͱ࣮ߦͰ͖Δɹ
master key: XXXXXX $ [Rails opens config/secrets.yml.enc in unencrypted form in EDITOR] $ [Saving the opened file will encrypt the file back into config/ secrets.yml.enc] • RAILS_MASTER_KEYがあればそれを使う • デプロイ時はこれ
3s wait, 5 attempts retry_on AnotherCustomAppException, wait: ->(executions) { executions * 2 } retry_on(YetAnotherCustomAppException) do |exception| ExceptionNotifier.caught(exception) end retry_on ActiveRecord::StatementInvalid, wait: 5.seconds, attempts: 3 retry_on Net::OpenTimeout, wait: :exponentially_longer, attempts: 10 def perform(*args) # Might raise CustomAppException, AnotherCustomAppException, or YetAnotherCustomAppException for something domain specific # Might raise ActiveRecord::StatementInvalid when a local db deadlock is detected # Might raise Net::OpenTimeout when the remote service is down end end