Rails.application.eager_load!
ActiveRecord::Base.subclasses(&:name)
variable = _
rails console --sandbox
reload!
model.reload
.source_location
.source.display
Rails.application.secrets.
next
step
continue
quit
whereami
exit-program # if you are stuck in a loop
!!! # if you are stuck in a loop
exit-p
exit! # will kill everything including the server
disable-pry
ENV['DISABLE_PRY'] = nil # to re-enable
cd # into a model
ls # inside a model to list what it has
grep # a list of data?
= debug @variable
- binding.pry
f = File.new("file.type", 'w') # will be saved in the path that the console was started or you can define your own path
f << method.output; # ; means it wont spit out to your console
f.close # to save
def route_helper
Rails.application.routes.url_helpers
end
gem install bundler
bundle outdated
bundle outdated --pre # pre-release gems
bundle install --path path to install gems
bundle install --system # removes path setting
bundle clean
bundle install --standalone # for a standalone bundle i.e. to copy to a server
rvm install 2.3.8 -- --disable-dtrace
rvm reinstall 2.3.8 --with-openssl-dir=/usr/local/opt/openssl
rvm --default use 2.3.8
https://github.com/guard/guard/wiki/Add-Readline-support-to-Ruby-on-Mac-OS-X
Might be caused by generated binstubs (https://github.com/rbenv/rbenv/wiki/Understanding-binstubs) See: https://github.com/sstephenson/rbenv/wiki/Understanding-binstubs
To reset the binstubs, just delete your bin/ directory in rails and run:
bundle install --binstubs
bundle binstubs rake
To reset the binstubs, just delete your bin/ directory in rails and run:
rake app:update:bin
require 'sidekiq/api'
default_queue = Sidekiq::Queue.new
specific_queue = Sidekiq::Queue.new("specific")
default_queue.size
default_queue.clear
stats = Sidekiq::Stats.new
stats.processed
stats.failed
stats.queues
stats.enqueued
Sidekiq::Client.registered_workers
Sidekiq::Client.registered_queues
Sidekiq.redis { |r| r.lrange "queue:app_queue", 0, -1 }
Sidekiq::Client.registered_queues.each do |q|
Sidekiq.redis { |r| r.lrange "queue:#{q}", 0, -1 }
end
Sidekiq.redis do |r|
r.srem "queues", "app_queue"
r.del "queue:app_queue"
end
Note: Unfortunately, removing a specific job is a little more difficult as you'd have to copy its exact value:
Sidekiq.redis { |r| r.lrem "queue:app_queue", -1, "the payload string stored in Redis" }
Sidekiq::ScheduledSet.new.clear
Sidekiq::RetrySet.new.clear
$ redis-cli
> select 0 # (or whichever namespace Sidekiq is using)
> keys * # (just to get an idea of what you're working with)
> smembers queues
> lrange queues:app_queue 0 -1
> lrem queues:app_queue -1 "payload"