Patrick L. wrote:
> Hey folks,
> I have encountered what's beginning to look like a classic problem with
> Rails: validating non-model forms. Under what circumstances do you need
> to use non-model components in a model-backed form? I need to for credit
> card processing: I want to save information like the customer's phone
> number but I don't want to save their credit card number for security
> reasons.

Add attr_accessor :cc_number to your model, then validate it.

Then call .save(false) when saving the model object internally, to bypass all 
your validations.

Everything will work as if you had a column with that name, except 
find_by_cc_number, or loading the number (natch).

Also f.text_field will work, so Card.new(params[:card]) will work.

-- 
   Phlip


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to