You can create a dummy model to facilitate your form information. There is no need to save models in the database.
Just create a new file in the application / models and you will go very well.
example: app / models / ccinfo.rb
class Ccinfo < ActiveRecord::Base attr_accessor :card_type, :card_number, :pin, :exp_month, :exp_date, :card_holder, ... validates_presence_of :card_holder ... end
If the form is based on a different model, you can simply move the insides of the specified model into a model form based on the same effect.
Can you check without saving by calling valid? method. Throw errors, as with any other model, if they are valid? returns false. Otherwise, continue processing.
source share