Google Mail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Confirmation Checkboxes - any good ideas?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Follow-up To:
Add Cc | Add Follow-up to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers that you hear
 
icke  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 13:10
From: icke <owain.mcgu...@gmail.com>
Date: Thu, 5 Nov 2009 05:10:55 -0800 (PST)
Local: Thurs 5 Nov 2009 13:10
Subject: Confirmation Checkboxes - any good ideas?
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.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis Haskin  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 14:04
From: Denis Haskin <de...@haskinferguson.net>
Date: Thu, 05 Nov 2009 09:04:48 -0500
Local: Thurs 5 Nov 2009 14:04
Subject: Re: [Rails] Confirmation Checkboxes - any good ideas?
My approach on things like this has been to add the attribute to the
model with attr_accessor, and then setting up whatever validations I
need.  E.g.

attr_accessor :terms_of_service

validates_acceptance_of :terms_of_service

Seems to work fine (I've had issues where I've been passing such a model
along a multi-action process by storing it in the session, though).

(Still not sure from a business/legal sense why you wouldn't need these
to be persistent attributes, however)

dwh


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marnen Laibow-Koser  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 14:15
From: Marnen Laibow-Koser <rails-mailing-l...@andreas-s.net>
Date: Thu, 5 Nov 2009 15:15:42 +0100
Local: Thurs 5 Nov 2009 14:15
Subject: Re: Confirmation Checkboxes - any good ideas?

Denis Haskin wrote:
> My approach on things like this has been to add the attribute to the
> model with attr_accessor, and then setting up whatever validations I
> need.  E.g.

> attr_accessor :terms_of_service

> validates_acceptance_of :terms_of_service

> Seems to work fine (I've had issues where I've been passing such a model
> along a multi-action process by storing it in the session, though).

> (Still not sure from a business/legal sense why you wouldn't need these
> to be persistent attributes, however)

Agreed on all counts.  Booleans are cheap, and you probably want to
store something that proves acceptance.

> dwh

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lardawge  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 14:42
From: lardawge <larda...@gmail.com>
Date: Thu, 5 Nov 2009 06:42:22 -0800 (PST)
Local: Thurs 5 Nov 2009 14:42
Subject: 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:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
lardawge  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 14:44
From: lardawge <larda...@gmail.com>
Date: Thu, 5 Nov 2009 06:44:09 -0800 (PST)
Local: Thurs 5 Nov 2009 14:44
Subject: Re: Confirmation Checkboxes - any good ideas?
Ha, should have refreshed before I submitted my answer.

On Nov 5, 9:42 am, lardawge <larda...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
icke  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 15:57
From: icke <owain.mcgu...@gmail.com>
Date: Thu, 5 Nov 2009 07:57:35 -0800 (PST)
Local: Thurs 5 Nov 2009 15:57
Subject: Re: Confirmation Checkboxes - any good ideas?
Thank you all for your replies.

I agree that Booleans are cheap in terms of storage but I not really
want to keep adding database columns through the model as the number
of questions vary over time and I do not really want to go through all
of the hassle of a child table to hold them.  I'm thinking of having
one (persistent) attribute on the model which is a serialized hash of
the questions and the answers.  Any thoughts.  Am I just being lazy?

O.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Denis Haskin  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 16:22
From: Denis Haskin <de...@haskinferguson.net>
Date: Thu, 05 Nov 2009 11:22:42 -0500
Local: Thurs 5 Nov 2009 16:22
Subject: Re: [Rails] Re: Confirmation Checkboxes - any good ideas?

As long as you don't need to query on those values ("send email to all
users who haven't yet agreed to the latest T&Cs"), the serialization
approach will work.

(and with accepts_nested_attributes_for and fields_for, how much work is
a child table, really? ;-) )

dwh


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Euwyn Poon  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 16:43
From: Euwyn Poon <euwynp...@gmail.com>
Date: Thu, 5 Nov 2009 11:43:23 -0500
Local: Thurs 5 Nov 2009 16:43
Subject: Re: [Rails] Re: Confirmation Checkboxes - any good ideas?

Use validates_acceptance_of

See
http://stackoverflow.com/questions/445293/ruby-on-rails-confirmation-...

Euwyn

On Thu, Nov 5, 2009 at 11:22 AM, Denis Haskin <de...@haskinferguson.net>wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Marnen Laibow-Koser  
View profile   Translate to Translated (View Original)
 More options 5 Nov, 17:47
From: Marnen Laibow-Koser <rails-mailing-l...@andreas-s.net>
Date: Thu, 5 Nov 2009 18:47:55 +0100
Local: Thurs 5 Nov 2009 17:47
Subject: Re: Confirmation Checkboxes - any good ideas?

Denis Haskin wrote:
> As long as you don't need to query on those values ("send email to all
> users who haven't yet agreed to the latest T&Cs"), the serialization
> approach will work.

It will work, but it's smelly in DB terms.

> (and with accepts_nested_attributes_for and fields_for, how much work is
> a child table, really? ;-) )

And with proper use of migrations, how much work is adding columns,
really?

> dwh

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
--
Posted via http://www.ruby-forum.com/.

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google