7/13/2012 – Happy Friday

July 13, 2012 Glenn Jahnke

Helps

  • Heroku Maintenance Mode Fail

Does anyone know why maintenance mode doesn’t seem to work? Is there any way to check from the command line that we are in maintenance mode?

— (Ken) This is how I test it on heroku_san: https://github.com/fastestforward/heroku_san/blob/master/features/step_definitions/remote_steps.rb#L130

  • Sending Faxes from Rails

Anyone had to send a fax from Ruby/Rails? Any good SaaS you used to do it?

  • carrierwave custom processing is called twice

Dumb workaround:

def intelligent_crop
crop_to = model.crop_to
# crop_to = [left_x, top_y, width, height]

manipulate! do |img|
  # guard against the second time intelligent_crop is called
  if (img.columns != crop_to[2] || img.rows != crop_to[3])
    img.crop!(*model.crop_to)
  end

  img
end

end

version :cropped_preview do
process :intelligent_crop
end

No one seems to have heard of this particular bug, unfortunately.

  • acts_as_soft_delete

What is the best soft-delete gem to help you not actually delete records?

acts_as_soft_delete_by_field was recommended, however rolling your own is probably also a very reasonable idea: this is pretty closely tied to your business logic.

Interestings

  • validate_presence_of does not work with booleans

…because it fails if the boolean is set to false. Use

validates_inclusion_of :boolean_field, in: [true, false], allow_nil: false

instead.

About the Author

Biography

Previous
Integrating Remote Developers: Intuitive, Flexible Video Conferencing
Integrating Remote Developers: Intuitive, Flexible Video Conferencing

I recently blogged about about integrating remote developers with large development teams. An important but...

Next
Cedar target templates for Xcode 4.3.x
Cedar target templates for Xcode 4.3.x

Announcing Cedar target templates for Xcode 4.3.x: Getting started with Cedar has never been easier! Thes...

×

Subscribe to our Newsletter

!
Thank you!
Error - something went wrong!