I’m currently working on an application to take donations using Mephisto, ActiveMerchant and a custom Mephisto plugin. We’re not storing any of the credit card data in the database so I needed to extend the model to virtually include the credit card number, expiration date and card type.
In C# I would add getter and setter methods as such:
public int ccnumber
{
get
{
return _ccnumber;
}
set
{
_ccnumber = value;
}
}
Ruby makes this much easier and really is elegant.
attr_accessor :ccnumber
Beautiful isn’t it? When part of an ActiveRecord model you have full validation capabilities as well.
FYI – If you want to write plugins for Mephisto, you’ll need Rails 1.2.x+ and the edge version of Mephisto from the repository. 7.3 doesn’t have plugin capability.
Subscribe
Leave a Reply