5 posts tagged

rails

For Rails 3.x, configure a logger in config/environments/test.rb:

config.logger = Logger.new(STDOUT)
config.logger.level = Logger::ERROR

This will interleave any errors that are logged during testing to STDOUT. You may wish to route the output to STDERR or use a different log level instead.

Sending these messages to both the console and a log file requires something more robust than Ruby's built-in Logger class. The logging gem will do what you want. Add it to your Gemfile, then set up two appenders in config/environments/test.rb:

logger = Logging.logger['test']
logger.add_appenders(
    Logging.appenders.stdout,
    Logging.appenders.file('example.log')
)
logger.level = :info
config.logger = logger
dockerrails
Apr 29, 2016, 15:42

capistrano rails seed

namespace :deploy do
	desc "reload the database with seed data"
	task :seed do
	 puts "\n=== Seeding Database ===\n"
	 on primary :db do
	  within current_path do
	    with rails_env: fetch(:stage) do
	      execute :rake, 'db:seed'
	    end
	  end
	 end
	end
end
rails
Sep 29, 2015, 12:29

Rails + SSE = попоболь

clojurerails