Created
September 10, 2010 13:28
-
-
Save bill-transue/573615 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Vlan < ActiveRecord::Base | |
| include VlanType | |
| validates_inclusion_of :type, :in => [:public, :private, :static] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class VlanProfile < ActiveRecord::Base | |
| include VlanType | |
| validates_inclusion_of :type, :in => [:public, :private, :static] | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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