Thursday, November 5, 2009

[Rails] Re: Confirmation Checkboxes - any good ideas?

You would need to add an attr_accessor and validates_presence_of in
your model...

class Model < ActiveRecord::Base

attr_accessor :field_to_validate
validates_presence_of :field_to_validate

end

On Nov 5, 8:10 am, icke <owain.mcgu...@gmail.com> wrote:
> I have a site in development that I need to customer to confirm a few
> things before they can proceed to the payment page.  I intend to
> present them with the relevant questions and then check that they have
> answered them e.g. have you read the T's & C's.  Are you over 18?  Are
> you resident in the UK etc etc.  I do not need to record these
> necessarily.
>
> Is there a simple way of validating these in the controller and then
> returning the messages in the same way as Active Record would do so I
> can use the same form builder as the rest of the site (I do inline
> errors with ToolTip)?
>
> I have considered just implementing a model called "Confirmation" with
> a 1-1 relationship with order but I think this is a little overkill
> and the number of confirmations may change over time and vary.  So I
> would need a to implement a confirmation answer model and a
> confirmation question model.  All seems a bit complex.  How about just
> serializing a hash as a database column with the questions as the key
> and the values entered?
>
> Has anyone got any good ideas?
>
> Thanks,
>
> O.
--~--~---------~--~----~------------~-------~--~----~
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 rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate