Skip to content

Instantly share code, notes, and snippets.

@bill-transue
Created September 10, 2010 13:28
Show Gist options
  • Select an option

  • Save bill-transue/573615 to your computer and use it in GitHub Desktop.

Select an option

Save bill-transue/573615 to your computer and use it in GitHub Desktop.
class Vlan < ActiveRecord::Base
include VlanType
validates_inclusion_of :type, :in => [:public, :private, :static]
end
class VlanProfile < ActiveRecord::Base
include VlanType
validates_inclusion_of :type, :in => [:public, :private, :static]
end
module VlanType
def type
read_attribute(:vlan_type).to_sym
end
def type= (value)
write_attribute(:vlan_type, value.to_s)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment