Hello,

I'm a complete newbie to Rails, and am trying to jump in and add
something to my application.  I'm trying to have users check a checkbox,
accepting our terms of service, prior to registering.  I have validation
scripts written to ensure that the user first and last name fields
aren't left blank (validates_presence_of), and  also have scripts doing
password length checks.  I cannot for the life of me figure out how to
make the checkbox validation work.

I have entered the following into my user.rb model :

class User < ActiveRecord::Base
  validates_acceptance_of :eula, :message => "must be agreed to"

My other validations are there as well - example:

validates_presence_of     :first_name


I have entered the following in the signup.html.erb file :


  <%= check_box :user, :eula %>
  <label for="terms_of_service">By checking this box I am agreeing to
Meeteor's <a href="../sites/terms_of_service"> Terms of
Service</a></label>

I entered this script down near the bottom of the page right next to the
signup button.  My other validation scripts read code from the following
block :

  <div class="login-register-box">
                    <div class="title">Personal Information</div>
                        <div class="blnk-spc-10"><!-- --></div>
                        <div class="wid-100-per">
                         <%form_for(:user,:url => { :controller =>
"users", :action => "meetjoe_signup" },:html => { :onsubmit=>"return
true;" }) do |f| %>
                          <div id="error">
                              <%= error_messages_for :current_user %>
                            </div>
                           <%= f.hidden_field :login %>
                           <input  size="30" name="is_roommate"
id="is_roommate" type="hidden" value="<%...@is_roommate%>"/>
                            <table width="100%" border="0"
cellspacing="0" cellpadding="0">
                              <tr>
                                <td width="30%" ><b>First Name</b></td>
                                <td><%= f.text_field
:first_name,:class=>"input-field" %><span
class="important">*</span></td>
                              </tr>


I'm not sure I've included everything I need to - please let me know if
anything isn't clear or if I need to add add'l info.  Thank you for your
help!
-- 
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.

Reply via email to