similar to: validates_format_of ?

Displaying 20 results from an estimated 4000 matches similar to: "validates_format_of ?"

2007 Oct 13
4
Chapter 9
Hello, I''m currently stunk on this issue for few days and I do not know how to get it fixed. The system always raises this error message : order is closed and here is my order.rb: class Order < ActiveRecord::Base include ActiveMerchant::Billing before_validation :set_status attr_protected :id, :customer_ip, :status, :error_message, :updated_at, :created_at attr_accessor
2008 Jun 07
3
DRY validates_format_of?
In a model I have following validates_format_of. Is there an easy way to DRY this up? It seems to be rather repetitive. validates_format_of :expiration_date, :with => /^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/ validates_format_of :activation_date, :with => /^[0-9]{4}[-][0-9]{2}[-][0-9]{2}$/ validates_format_of :some_other_date, :with =>
2012 Aug 14
3
validates_format_of :message not working, validates_length_of :message is working
I''m using validates_format_of and the validation I want to do works, but I can''t get an error message to be displayed if the data is invalid: validates_format_of :mobile, :with => /\A[\+0-9]+\Z/, :message => " - Wrong" I have another validation some where else that does display the error message: " - Name is too long" validates_length_of :name,
2008 Feb 24
1
validates_format_of no dots allowed
I need a validates_format_of that disallow dots. In the api there is nothing to find about how validates_format_of exatly works. Is there a better documentation or is there something that can tell me howto disallow dots. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups
2005 Nov 28
4
validates_format_of nil
I''ve noticed that validates_format_of will return invalid if the field is nil. Question 1) How should we declare a validation that will validate it with a regex if it is set, but, if the field is not set, just move on Question 2) Why is it done this way? The other validators are only invoked if the field is set . If you want to declare the field mandatory, you add a
2006 Apr 13
7
Complex SQL in paginate command?
Hi all, Is there a way to create pagination with a complex SQL, more complex than the :conditions option will support? I have two databases, houses and images. Houses has_many images, and each Image belongs_to house. I''m creating a search engine for the house records and I''d like to be able to filter out all the houses without any associated images. So far I''m
2008 Aug 31
6
why's my course_duration being reset
Can''t get this?...I''m close I think, my calculation appears to be working, but.... when i access duration = <%= @enquiry.course_duration %><br> in my final view it''s blank.. course_duration is getting set to null but works for the calculation? controller.. ---------- class EnquiriesController < ApplicationController layout ''welcome''
2010 Jan 18
3
validates_format_of :phone,
validates_format_of :phone, :with => /\A\s*(?:(?:\+?(?:\d{1,3}(?:\s*|[\-.])))?\(?\d{3}[\-\/)]?\s*) (?:[2-9][0-9 \-.]{6,})\s*\z/, i pit it on my reuriments but error whlie entering 666.111.9999 i want it should be ok any one help me please -- 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
2006 Jan 20
4
validates_format_of > Invalid regular expression with simple pattern
Hello, I try this : validates_format_of :name , :with => /^[A-z0-9_.- ]*$/ , :message => "bad characters" for accept any name with chars "A" to "z" , "0" to "9" , with "_" "." "-" and " " The pattern is really simple but I have this error : SyntaxError in Login#register
2006 Apr 11
6
Reduce Number of Queries When Using ActiveRecord
I have a controller method called update_all that grabs parameters for about 30 form fields and saves them to the database. My current code looks to see if there is a string in params[] for each form field (two fields for each SelfEvaluationItem) and saves the updated self_evaluation_answer if a string is available. Since this is iterated code, I am almost certain that this generates 30 or so
2006 Jun 14
1
file column validates_format_of
Been manually testing file column with success except it seems to upload the file before validating it. Also .pdf files (which shouldn''t even validate) crash WEBrick. What am I missing to solve these problems? (apart from a brain!) validates_presence_of :title, :file validates_format_of :file, :with => %r{.(gif|jpg|png)$}i, :message => "File must end with .jpg, .gif or
2005 Aug 10
5
validates_format_of on an optional field using :if
Hi there, I''ve got the following in my model: validates_format_of :postcode, :with => /^([a-zA-Z]{1,2}[0-9]{1,2} [0-9]{1}[a-zA-Z]{2})$/, :message => "is not valid", :if => :postcode ... but it''s not working - it always insists on validation, even if postcode is empty. Basically, the postcode field is optional, but if it''s filled in, I want to
2009 Feb 28
7
be_valid (validates_format_of ..., :on => :create)
Greetings, How to write Example which will check if model''s variable''s format is valid using :on => :create, like this: class User < ActiveRecord::Base ... validates_format_of :email, :with => /.../, :on => :create ... Using following code is not right: it "should ..." do @user = users(:example_user) @user.email =
2007 Feb 16
13
negate the regexp in validates_format_of
Railsters: ActiveRecord''s validation system puts other database systems to shame. However, the newbies might not know how to write a regexp that excludes a match, instead of tests for it. Understand - I''m just asking this question to help them. I have been using Regexps since ''grep'' on Xenix! But the newbies here might not know how to do this:
2006 Apr 24
5
Sanitising a Phone Number input
I want to sanitise a phone number input. In my UsersController.rb file I have written a method that will take a string and reduce it to numbers only. This works find if I call it manually, but in the interests of keeping DRY I would like to ensure that the code sanitisation method is called whenever the data is edited (I''m using standard scaffolidng for this test). Is there anyway
2006 Sep 10
1
validates_format_of :something, :with => /REGEX/
Hi all, I''m hoping to stir the Rails pot a little bit here, so please go easy with me ;-) Regular Expressions is the most densely inhumane language construct ever invented in any ''civilisation'', and the fact that we still have to dirty our minds with this in Rails is something that (sh/c)ould ideally be corrected in Rails (preferably before the release of 1.2
2006 Apr 14
1
Validating Existing Models
I''ve got a user object which has quite a few attributes mapped to the database. As of right now I''ve got some validations in the model like: validates_presence_of :password, :message => "You must specify a valid password." validates_confirmation_of :password, :message => "Password doesn''t match the confirmation." validates_presence_of
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 Oct 18
0
validates_format_of date
Can someone tell me why this returns ''dob is invalid'' when dob is ''01/01/1969''? validates_format_of :dob, :with => /[0-9]{2}.[0-9]{2}.[0-9] {4}/, :message => ''is invalid'' I''m trying to validate a date entred into a form. I suppose there are different ways to accomplish this, and because it doesn''t work, I''m
2006 Mar 17
0
validates_format_of before type_cast?
Often I need to do a one-off validation before Rails has had a chance to convert. For example, a date. Is there a general mechanism to cause validations to run on the raw input or do I have to resort to: private def validate unless attributes_before_type_cast[''date_of_loss''] =~ /^(\d+(-|\/)){2}\d{4}/ errors.add(''date_of_loss'', ''use the