XML or YML?

Sharagoz wrote:

You are right, creating a database table for something like this does feel like overkill. Personally, I often use constants if it's a very small amount of data.

class Image   VALID_IMAGE_TYPES = ['png', 'gif', 'jpg'] end

Good idea.

or IMAGE_TYPES = {:1 => 'Photo', :2 => 'Document', :3 => 'Print'}

Not a good idea -- why use :1, :2, :3 instead of actual numbers or symbolic keys?

Best,

Yes - in my own file_attachment object, I use the same constant! :slight_smile:

Not only is it a bad idea, it's invalid ruby syntax. Integers cant be symbols.

'Print' } => {:"3"=>"Print", :"1"=>"Photo", :"2"=>"Document"}

But that's not really making the idea any better :wink:

-Rob

Rob Biedenharn http://agileconsultingllc.com   Rob@AgileConsultingLLC.com

  rab@GaslightSoftware.com