Skip to content

Instantly share code, notes, and snippets.

View guillec's full-sized avatar

Guille Carlos guillec

View GitHub Profile
# ME
tmux -S /tmp/pair
chmod 777 /tmp/pair
# Partner
tmux -S /tmp/pair attach
dut = Organization.find(61)
bookings = dut.bookings.where(voyage_number: "0MQ35W1")
bookings.each do |booking|
booking.containers.each do |container|
last_movement = container.previous_movement
if last_movement.gate_in? && last_movement.booking.nil?
bookings = container.bookings.where(voyage_number: "0MQ35W1")
bookings.each do |booking|
bc = booking.booking_containers.where(container_id: container.id)
bc.container_id = nil
can't add a new key into hash during iteration /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/scoping.rb:75:in
`set_value_for' /app/vendor/bundle/ruby/2.4.0/gems/activesupport-4.2.8/lib/active_support/per_thread_registry.rb:50:in
`set_value_for' /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/scoping.rb:18:in
`current_scope=' /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/relation.rb:304:in
`ensure in scoping' /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/relation.rb:304:in
`scoping' /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/associations/collection_proxy.rb:874:in
`scoping' /app/vendor/bundle/ruby/2.4.0/gems/activerecord-4.2.8/lib/active_record/relation/delegation.rb:70
class Voyage
def prepare_voyage(vessel)
vessel.prepare
end
end
class Vessel
def prepare
.. do stuff ..
end
1. How to reset with origin
git reset --hard origin/master
2. How to rebase interactively. -i
3. How to add just part of a file.
4. How to check out just a file from another branch
5. How to fix commit with ammend and -i
6. git bisect
Consignee.all.each do |consignee|
if consignee.similar_names.count >= 1
puts consignee.similar_names.count
puts consignee.name
puts consignee.id
puts "=========================="
end
end