Rails Tips & Tricks #3



1. rails notes

Rails show you all leaved notes. Like TODO, FIXME etc.

2.  Auto Clearing logs

Add file clear_logs.rb to confi/initializers


return unless Rails.env.development?

MAX_LOG_SIZE = 10.megabytes
logs = File.join(Rails.root, 'log', '*.log')
return unless Dir[logs].any? { |log| File.size?(log).to_i > MAX_LOG_SIZE }

$stdout.puts 'Running rails log:clear'
`rails log:clear`

Comments