class SmartEnum::Associations::HasAssociation

Public Instance Methods

foreign_key() click to toggle source
# File lib/smart_enum/associations.rb, line 129
def foreign_key
  @foreign_key ||=
    begin
      return foreign_key_option.to_sym if foreign_key_option
      if owner_class.name
        SmartEnum::Utilities.foreign_key(owner_class.name).to_sym
      else
        raise "You must specify the foreign_key option when using a 'has_*' association on an anoymous class"
      end
    end
end