Skip to content

Instantly share code, notes, and snippets.

@mingliangfeng
Last active May 1, 2019 01:24
Show Gist options
  • Save mingliangfeng/5212987 to your computer and use it in GitHub Desktop.
Save mingliangfeng/5212987 to your computer and use it in GitHub Desktop.
Rails
# render empty page from controller
render :nothing => true, :status => 200, :content_type => 'text/html'
# manually call a job
Delayed::Job.find(10).invoke_job # 10 is the job.id
# prepare test database
rake db:test:prepare
# find which line of code defines a rake task
> rails c
> require 'rake'
> Rake::TaskManager.record_task_metadata=true
> Rake.application.load 'Rakefile'
> tsk = Rake.application.tasks.each.find {|t| t.name == 'my_task_name'}
> tsk.locations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment