I guess that in many ways I'm still a newbie with some of this rails stuff. I have ActiveRecord Model for Payments. But, it only has two things that get added to it's table and those are done once we get a positive response back from authorize.net. In the Controller for this model I have my Cart form. Within the Cart form I have billing information with default values pulled from @client and the credit card information. It looks a bit like this:
<%= form_for @payment, :url => { action: "checkout" } do |f| %>
...show errors ...
<%= f.fields_for @client do |ff| %>
<%= ff.label :firstname, 'First Name*' %>
<%= ff.text_field :firstname %>
...more fields ....
<%= ff.label :zip, 'Zip*' %>
<%= ff.text_field :zip %>
<% end %>
<%= f.label :cardnumber, 'Card Number*' %>
<%= f.text_field :cardnumber %>
... more cc info fields ...
<% end %>
Now in the Model I have added attr_accessor :cardnumber, and other card info fields.
I don't have any getter or setter methods for these (perhaps that is what I am missing).
However, I do have this in the Payment Model:
validates :zip, presence: true, numericality: true
validates :cardnumber, presence: true, numericality: true
Yet, so far the form will bypass this validation all together and goes direction to the checkout. Any help would be greatly appreciated! How do I get these validations to work properly?