<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sentia &#124; Sydney IT Consultancy, Software Development, Ruby on Rails, Web Application Development, Rails Development, Test Driven Development, Microsoft.Net, Asp.Net , Agile, Continuous Integration Training, iPhone development &#187; validates_acceptance_of</title>
	<atom:link href="http://www.sentia.com.au/tag/validates_acceptance_of/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sentia.com.au</link>
	<description>Sentia company website and blog about all things development, Ruby on Rails, Microsoft .Net, ASP.Net, C#.Net, Agile web development, Test Driven Development</description>
	<lastBuildDate>Thu, 02 Feb 2012 07:16:46 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Please accept the terms of service and privacy policy</title>
		<link>http://www.sentia.com.au/2009/03/please-accept-the-terms-of-service-and-privacy-policy/</link>
		<comments>http://www.sentia.com.au/2009/03/please-accept-the-terms-of-service-and-privacy-policy/#comments</comments>
		<pubDate>Wed, 11 Mar 2009 05:24:58 +0000</pubDate>
		<dc:creator>Michael Cindric</dc:creator>
				<category><![CDATA[ruby on rails]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[validates_acceptance_of]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://blog.sentia.com.au/?p=113</guid>
		<description><![CDATA[If you need users the accept the terms of services &#8230; <a href="http://www.sentia.com.au/2009/03/please-accept-the-terms-of-service-and-privacy-policy/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you need users the accept the terms of services and privcay policy or your rails application there is a simple way to handle this without a database field or javascript. It&#8217;s using the validation methods built into rails. Simply add the following code to your User model for example</p>
<pre class="brush: ruby; title: ; notranslate">
validates_acceptance_of :terms_of_service
</pre>
<p>Then in your view add the following to your view and you will get a checkbox on the page that users will be required to check.</p>
<pre class="brush: ruby; title: ; notranslate">
&lt;%= check_box :user, :terms_of_service %&gt;
</pre>
<p>This will then add this validation rule to your models validation rules and when you try to submit the form without checking the checkbox you get a nice little validation message letting you know hey you need to accept this.</p>
<p>Of course you can have your own validation message displayed like so</p>
<pre class="brush: ruby; title: ; notranslate">
validates_acceptance_of   :terms_of_service, :message =&gt; ' and the privacy policy must be accepted'
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.sentia.com.au/2009/03/please-accept-the-terms-of-service-and-privacy-policy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

