Frederick Cheung wrote:
> On Nov 5, 7:31�pm, James Byrne <[EMAIL PROTECTED]>
> wrote:
>> � � default_location_type = 'MAIN'
>>
> Personally I would have it as a constant of the Location class, ie
> 
> class Location ...
>   VALID_TYPES = [...]
> end
> 
> Fred

Point taken.

Nonetheless, in the interim I have tested it and this does indeed work 
as expected.  However, I used private methods and public getters to 
implement.

  def valid_location_type
    virt_valid_type
  end

private

  def virt_valid_type
    vvt =
      [
        ['MAIN - Main Address', 'MAIN'],
        ['POST - Postal Delivery', 'POST'],
        ['DELV - Package Delivery', 'DELV'],
        ['SHIP - Package Shipping', 'SHIP'],
        ['OTHR - Other', 'OTHR']
      ]
  end


But my question remains:  Is this the preferred idiom or is there 
another recommended way to do this?
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to