Andrew Porter wrote: > Patrick L. wrote: >> But when the model is saved, the :card and :expiration_date fields are >> not validated because they're not part of the model (they are accessed >> using params[:cc][:card] and params[:cc][:expiration_date]). > Add them as attributes to the model and then create validation rules as > normal - > > attr_accessible :expiration_date > > validates_presence_of :expiration_date
Thank you both. I implemented Andrew's solution, and it seems to work. Thing is, it doesn't wrap the expiration_date input field in the error div (in other words, it doesn't turn red). How should I fix this? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

