This file contains 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 CreditCardType < ActiveRecord::Base | |
acts_as_enumeration :lookup_name | |
column :name | |
def initialize(attributes = nil) | |
super | |
self.lookup_name ||= name.to_s.gsub(/[^A-Za-z0-9-]/, '').underscore | |
end | |
create :id => 1, :name => 'Visa' |
This file contains 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 CreditCardType < ActiveRecord::Base | |
acts_as_enumeration | |
column :display_name | |
# defaults :name => :default_name # Uses the active_record_defaults plugin | |
def initialize(attributes = nil) | |
super | |
self.name = default_name unless attributes && attributes.include?(:name) | |
end |
NewerOlder