search for: validates_acceptance_of

Displaying 18 results from an estimated 18 matches for "validates_acceptance_of".

2006 Feb 08
5
validates_acceptance_of + functional testing
I had to add a check box indicating that a user accepted certain terms to a page. So, I put in a ''validates_acceptance_of :terms'' line into the appropriate model and added a checkbox to my view. Everything works as expected in my web browser. However, my functional tests still pass and I didn''t add or change anything to them. I was expecting to have to add another field called ''terms'...
2007 Aug 21
2
validates_acceptance_of (and hidden input)
Hi Why does a failed "validates_acceptance_of" create a hidden input in the view? cheers, jason --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocF...
2006 Jul 21
1
validates_acceptance_of weirdness
On my registration form I have a checkbox for a waiver. In the model I have the statement: validates_acceptance_of :waiver, :on => :create, :message => "must be accepted" In the view: <%= check_box_tag("waiver") %> <%= error_message_on "user", "waiver", "Waiver "%> For some reason validate is accepting everything when the checkbox is NOT c...
2006 Apr 07
0
validates_acceptance_of problem
I''m having some difficulties getting validates_acceptance_of to work. No matter whether I tick the checkbox for my terms and conditions on my form, it will not submit it and shows my error message. in my model i have: validates_acceptance_of :agree_to_terms, :message => "" in my view i have: <%= error_message_on :user, :agree_to_terms...
2006 Apr 27
1
validates_acceptance_of, virtual attributes and mass assign
Hi, I''ve a question concerning validates_acceptance_of method. Documentation says that the validated attribute is a virtual one, without a field in db. But when I add such an attribute to my form (say check_box(:xyz, :agreement)), it''s passed in params[:xyz][:agreement], but not assigned when calling Xyz.new(params[:xyz]), probably because...
2006 Oct 04
0
Displaying validates_acceptance_of Errors In A Check Box
...ng. My code follows. Should I get cleverer with the CSS or write my own check_box helper which wouldn''t wrap both the visible and the hidden check boxes in <div class=''fieldWithError'' /> tags -- or something else altogether? In my customer model I have: validates_acceptance_of :terms In my view I have: <% form_for :customer, @customer, :url => { :action => :store } do | c| %> <p><%= c.check_box :terms %> I have read and agree to the Software Licence Agreement.</p> <%= submit_tag %> <% end %> When the user submits the...
2006 Feb 28
6
How To Validate Boolean Form Field
Hello all. I''ve got the following in my model: class Individual < ActiveRecord::Base validates_presence_of :first_name, :last_name, :street, :city, :state, :zip validates_acceptance_of :AZ_resident, :message => "You must be an Arizona resident." end The AZ_resident field is present and defined as boolean (PostgreSQL 8.1), but validation will not occur. I''ve tried adding :accept => "TRUE" and variations on the theme, to no avail. So, what...
2007 Nov 13
0
Allowing validates_acceptance_of to store value on the database column
I''ve reopened a ticket for this and provided a patch withs tests. From my notes on the ticket: > An example use case here, is that I want to use the current version of the EULA as the :accept value, and store that column, so I can refer to the explicit version the user accepted at a later date. http://dev.rubyonrails.org/ticket/7457 Any feedback and/or support for the patch is
2006 Jun 12
2
Validating a non-object attribute in a form via checkbox?
Hi there A user can place an ad with various attributes via a form; however, I want the user to check a box signifying that they''ve read the terms and conditions for use of the site. So the ''terms'' is not an attribute of the Advertisement model. I could check that the user has ticked the box in my controller but would like to bundle this up with the validation
2005 Nov 26
0
Model warnings along with Validations
Hi railers, Is there a simple method to extend Active Record to have similar functionality as the validate functions e.g. validate_on_find validates_acceptance_of validates_each validates_format_of validates_length_of validates_uniqueness_of etc... but only report warning on model attributes instead of errors(). I would like to save the model if there are warning and if the model is invalid (there are errors) do not save. maybe functions like: warn_on_fi...
2007 Dec 27
0
Silent Validation Failures
...to the view. However, the moment I uncomment the after_validation_on_create line in my model all the validations stop working. I only know they haven''t worked because the private methods throw NoMethodErrors when the user doesn''t enter something. Here''s an example: validates_acceptance_of :terms_of_service, :on => :create, :allow_nil => false validates_length_of :email, :within => 6..100 validates_uniqueness_of :user_alias, :email, :case_sensitive => false validates_inclusion_of :gender, :in => %w( m f ), :message => '': So what are you then?'...
2006 Jul 19
6
Howto: Check_box with a variable (no model)
Hi, I would like to put a checkbox on a form where the input field is a variable rather than a field in a model. The normal way (with a model) would be: <%= check_box(''client'', ''accept'', {}, "1", "0") %> But since accept is a variable @accept and model client will not be there, how do I make a check box work? Regards, Paul
2006 Apr 07
6
validation nightmare
Please help, I am really at a loss at how validation is supposed to work in rails. Model contains acts_as_tree I want to force my NEW objects to have a parent I do NOT want existing object to have a parent so I only want to have parent_id on create, NOT on update. I am trying this: def validate_on_create validates_presence_of :parent_id, :message => "You must specify a
2006 Jul 05
2
Serialized object behaves weird
Hi! I got a class named EinsatzFilter which I serialized to session. Before saving to session it works afterwards I keep getting the message: "undefined method `to_s'' for #<Person:0x38c6ab8>". "Person" is a from ActiveRecord::Base inherited class. Code: class EinsatzFilter include ApplicationHelper attr_reader :personen, :monat, :projekte, :kunde
2007 Nov 03
3
Birthdate validation
...zip_code, :message => "must contain only numbers." validates_presence_of :phone validates_numericality_of :phone, :message => "must contain only numbers." validates_presence_of :email validates_format_of :email, :with => /^([^@\s]+)@((?:[-a-z0-9]+\.)+[a- z]{2,})$/i validates_acceptance_of :policy_agreement, :message => "must be accepted. You have to read and agree with the Aykall Policies before signing in." validates_multiparameter_assignments :message => " is not a valid date." age_limit = Date.new(Date.today.year, Date.today.month, Date.today.day).chan...
2011 Jan 17
4
Factory Girl and attr_accessor with validation
I have a problem with a recent change to one of my models when created via Factory.create. class User < ActiveRecord::Base attr_accessor :tc_check validates :tc_check, :presence => true, :acceptance => true ... end The following definition fails, when calling Factory.create(:valid_user) Factory.define :valid_user, :class => User do |u| u.email
2009 Nov 26
9
ActionView::TemplateError (can't convert ActiveRecord::Error into String)
I cannot work out why this error is appearing. ActionView::TemplateError (can''t convert ActiveRecord::Error into String) on line #3 of app/views/button/_show_enquiry.html.erb: 1: <h1>Send us a message</h1> 2: <% remote_form_for :enquiry, :url => {:action => ''send_mail''} do | f| %> 3: <%= error_messages_for ''enquiry'',
2006 Jul 27
9
Introspecting validates_presence_of
Hello people, I''d like to detect whether an attribute of a model has vaildates_presence_of applied to it so I can automatically apply a mandatory (*) to the field...it doesn''t look easy...any ideas? Cheers, -- Dan Webb http://www.danwebb.net