LoginSignup
1
0

More than 3 years have passed since last update.

Rails使うときの細かなTips

Last updated at Posted at 2020-10-22

残しておかないと後で忘れそうな奴を書いておく。随時追記予定。

putsに色をつける

seedとかrake taskとかで色つけて出したいときに使える小技

puts 'aaa'.green

Datadogにエンドポイントでの挙動を細かく出したい (grape使用時)

このリファレンスを参照
https://docs.datadoghq.com/ja/tracing/setup/ruby/#grape

下記の実装例のように、リファレンスのoptionsにある analytics_enabled をtrueにするといい感じになる。
grapeとrails両方指定するのがポイント。

実装例

  require 'grape'
  require 'ddtrace'

  Datadog.configure do |c|
    c.use :grape, service_name: 'hoge-app', analytics_enabled: true
  end

  Datadog.configure do |c|
    c.use :rails, service_name: 'hoge-app', analytics_enabled: true
  end
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0