在Rails应用程序中实现ActiveRecord的find()和save()方法的最佳方法是什么?
我希望我的信用卡对象继承ActiveRecord和ActiveMerchant。
请注意:我知道将信用卡信息保存到数据库总是被认为是个坏主意,最好使用一个网关来方便您的信用卡存储。假定这是必要的,并且正在达到适当的安全标准(PCI、文件系统和数据库加密、网络分离等)。
发布于 2009-10-19 03:41:18
我使用以下内容创建了一个标准Rails ActiveRecord模型:
./script/generate model CreditCard first_name:string last_name:string number:string month:integer year:integer type:string start_month:integer start_year:integer issue_number:string这与信用卡的ActiveRecord定义相匹配。
此外,ActiveMerchant还提供了ActiveMerchant::Billing::CreditCardMethods,引用ActiveMerchant开发团队的话说:
可以包含到自定义信用卡对象中的
方便方法,例如基于ActiveRecord的信用卡对象。
我已经在我的信用卡模型中包含了ActiveMerchant::Billing::CreditCardMethods,并将翻译验证以确保我对信用卡的定义与ActiveMerchant的定义相匹配。
https://stackoverflow.com/questions/1586721
复制相似问题