similar to: Validation of params

Displaying 20 results from an estimated 7000 matches similar to: "Validation of params"

2006 Jan 30
1
Either/Or Validation
How would I use validations to ensure I either received a blank value or a ten digit number? If I set validates_length_of :field, :in => 0..10 then that would allow any value in-between. The allow_nil => true option does not seem to work. I''ve also tried using this with some combination of validates_numericality_of but cannot get it to work. Any help would be greatly
2010 Feb 10
6
validation problems
Hi, there. I have two validations in the model: validates_numericality_of :value, :only_integer=>true, :allow_blank=>true validates_size_of :value, :is=>9, :message=>"must be 5-digit number", :if=>Proc.new{|u| u.value.is_a?(Numeric)} They work as expected except when the :value is character/string like "a" "abc", the second validation will also output
2006 Apr 13
0
Custom validation of form fields?
I have been looking at the many validates_* methods that we have available and I am wondering is it possible to create a custom validation method to be performed on a form field? I have the following form (remote via ajax) <%= form_remote_tag :url => { :action => ''do_action'', :id => @pid }, :before =>
2007 Nov 03
3
Birthdate validation
Hello everyone, I''m almost cracking my head trying to do this birthdate validation. It turns out that I can only accept users with at least 18 years old and I''m trying to validate it writing this code on my user.rb fil at app/ models class User < ActiveRecord::Base validates_presence_of :full_name validates_presence_of :street_address validates_presence_of :city
2005 May 04
1
Conditional validations
I''ve been working with the problem that Joe Hosteny has been talking about on this list and on the tickets he''s posted (http://dev.rubyonrails.com/ticket/1196) and have come up with a tentative solution that I''d like to bring up here. What if we use a "conditional" parameter in the validates_* methods? Here''s how it would look like in practice:
2005 Dec 17
0
bug? saving (valid) updated object results in validation error
Hi! I have an error that I don''t understand. It shouldn''t be happening, according to the documentation! I have a class, defined as below. > class Coupon < ActiveRecord::Base > belongs_to :product > belongs_to :account > validates_presence_of :product > validates_associated :product > validates_presence_of :voucher > validates_presence_of
2006 Jul 08
1
overriding validation messages
I have the following in my model validates_numericality_of :lwind_id When a user submits a non numeric value for the lwind control, the default validaiton message is "Lwind is not a number". I need this to say "Land Window is not a number". I have placed the following in my model validates_numericality_of :lwind_id, :message => "Land Window is not a
2013 May 15
1
x and y lengths differ
I have a problem with R. I try to compute the confidence interval for my df. When I want to create the plot I have this problem: Error in xy.coords(x, y, xlabel, ylabel, log) : 'x' and 'y' lengths differ. I try this code: library(dplR) df.rwi <- detrend(rwl = df, method = "Spline",nyrs=NULL) write.table(df.rwi,file="rwi.txt",quote=FALSE,row.names=TRUE)
2004 Jun 22
2
question about window and inserting value
Hi again R People: I have the following time series: >x.ts Jan Feb Mar Apr May Jun Jul Aug Sep 2000 0.95 0.66 0.83 0.66 -1.45 -1.25 0.33 1.03 -0.48 2001 2.55 1.21 -1.10 -0.63 0.01 -2.20 -0.51 1.12 1.11 2002 -1.37 0.55 -0.63 -0.56 0.92 -1.73 0.59 0.77 0.30 2003 0.55 -0.01 -0.54 2.27 -1.29 -0.23 0.09 -0.50 -0.61 Oct Nov Dec 2000 0.84 -1.35
2006 May 31
1
ActiveRecord: When / where to validate data? Tricky question
First of all, thanks for you time. I have kind of a tricky question and wanted to see what you guys thought. ------------------------------------------- Lets say I have this: ------------------------------------------- class Purchase < ActiveRecord::Base validates_numericality_of :some_number, :only_integer => true end ------------------------------------------- Then I do this:
2006 Jun 21
3
validation help
I would like to validate a number within a certain range. To first test that a entry is a valid number i use validates_numericality_of :my_number, :message =>''sorry, not a number'' to test if the number is within a certain range i use validates_inclusion of :my_number, :in => min..max, message => ''outside range!'' If the numericality test fails, I
2006 Apr 27
0
DRY validation
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi all, A few months ago someone posted a message about specifying validates_* constraints on a per-attribute basis. I just created a small plugin that allows you to do this. Here''s an example from one of my models: class Country < ActiveRecord::Base attribute :name, :string do |a| a.validates_length :within =>
2005 May 26
0
Validation of Correct Date Submitted on Form
From what I can tell there is not validates_ functionality for dates is their? Do people just make custom validations for that too or it their a validates_functionality that I am missing? John Kopanas john-Iau1QiYlxLpBDgjK7y7TUQ@public.gmane.org
2012 Apr 08
2
xyplot() does not plot legends with "relation=free" scales
Hi all, I have this problem with lattice that xyplot() won't draw some of my axis labels if the type (i.e. the relation argument) of scales is set as free. For example, in the plot below, I would want it to also show: 1. the labels E1,...E6 below the 10th panel (i.e. 3rd row, 2 col)....just as it is now done below the 12th panel.... 2. as well as the labels (2,4,6,8) on the top of panels 1
2019 Apr 19
1
selftest: Perl error "Insecure $ENV{ENV} while running setgid at /home/user/src/samba-git/samba/source3/script/tests/printing/modprinter.pl line 138."
In my environment the selftest for samba3.rpc.spoolss.printer was failing at source3/script/tests/printing/modprinter.pl(138) with the Perl error in subject: Insecure $ENV{ENV} while running setgid at /home/user/src/samba-git/samba/source3/script/tests/printing/modprinter.pl line 138 code is: ============================== delete @ENV{'BASH_ENV'}; $ENV{'PATH'} =
2008 Apr 04
6
validates_numericality_of :not_equal_to
I have a situation in which I want to validate a number is not zero. Both positive and negative values are acceptable, just not zero. validates_numericality_of has an :equal_to attribute, but I don''t see a :not_equal_to. I have not yet been able to find anyone who has discussed this. I did find information about custom validators, so I am now using a custom validator to check the field
2006 Aug 01
0
Validation of facade columns
I''m having difficulty understanding how to make validation of facade columns consistent with validation of other active record columns. To illustrate this, I''m going to extend the facade column example discussed on pp. 284-5 of AWDR. Let''s say that there is a "rectangles" table that has width and height columns. For some unknown reason, width is stored in
2006 May 30
1
Not working validation
Hi there, I have some model classes where I''ve tested successful that validation worked. After some more days of iterations I found that that validation isn''t working anymore. The validation functions are not even called. Example: class Company < ActiveRecord::Base validates_uniqueness_of :name validates_numericality_of :money validates_each :money do |record, attr,
2006 Apr 19
2
validation :on => :update....
I would like to validate a model on several events. I have: validates_numericality_of :ships_in, :on => :update, :message => ''xyz....'' I have this validating on update, but I also want it to validate on save and on create as well. Do I have to duplicate this validator for each event? or is there something cool i can do like: :on => [:update, :save, :create] (which
2006 Aug 14
2
Plugins: Validation Reflection and Client-Side Validation
I''ve just put two plugins on RubyForge. Included below are the READMEs. You can get the plugins at svn://rubyforge.org//var/svn/valirefl/validation_reflection/trunk svn://rubyforge.org//var/svn/clientsidevali/client_side_validation/trunk Michael Validation Reflection ===================== Version 0.2, 2006-08-06 This plugin adds reflective access to validations -