similar to: validates_format_of :message not working, validates_length_of :message is working

Displaying 20 results from an estimated 900 matches similar to: "validates_format_of :message not working, validates_length_of :message is working"

2012 Aug 09
2
validate_format_of message
I have validates_format_of :name, :with => *my regex*, :message => "That''s wrong" The validation works but the message does not get displayed when the user enters invalid data. Does anyone have any ideas how to fix it? Thanks. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send
2006 Aug 17
2
validates_length_of with char field
I am new to ruby/rails and am having a problem with validates_length_of. It seems to work fine on a varchar field, but when I try it on a char field the extra characters are silently truncated and the message appears that the record was successfully updated. How can I get my app to produce my error message instead? I''ve tried various variations, but here''s one of my tries:
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 =>
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 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
2006 Apr 05
4
validates_format_of ?
Hi all, I''ve got a form which accepts a "price" field and I''m attempting to validate it and allow some flexibility in the way the user enters it. It''s a numeric field but I want the user to be able to enter dollar signs and commas naturally in the data entry. I''m trying to understand how to use validates_format_of, and I''m not sure what
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
2005 Jul 07
3
NameError Exception
Ruby/Rails n00b here so go easy on me... I''ve been wracking my brain trying to figure out what is wrong here. I''ve checked all my models for the appropriate belongs_to, has_many, etc. I''ve checked to make sure I''m using singular and plurals in the right spot. I''ve checked my syntax around all my "within"''s and nothing seems to fix
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 Apr 13
1
Model is not a class
I''m trying to specify a model in a controller, but rails gives me "Account is not a class", where Account is my model name ... This is my model: class Account < ActiveRecord::Base validates_presence_of :email, :email_confirmation, :username, :password, :password_confirmation validates_format_of :email, :with =>
2009 Sep 19
1
validations on a field
hi, i have a model with 2 validations on a field example: validates_presence_of :email validates_length_of :email, :within => 6..100 #r@a.wk validates_uniqueness_of :email validates_format_of :email, :with => Authentication.email_regex if i do the submit of form for a new object of the model with a blank mail i receive 4 errors. In this case i want receive
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
2010 Nov 11
5
ActiveRecord query
I have these sql code in postgresql "SELECT * from convenios where id NOT IN (SELECT convenio_id from solicituds where usuario_id=?" but don''t find a way of used it in rails except find_by_sql. There is a another way?? class Usuario < ActiveRecord::Base belongs_to :persona has_many :solicituds, :dependent => :destroy has_many :convenios, :through =>
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:
2007 Mar 29
4
validates_length_of not working with :if ?
Hello, I''m trying to cut down the errors if the guy already getting the empty nickname, so he doesn''t get anything about the nickname is short. validates_presence_of :nickname This below is not working ? validates_length_of :nickname, :within => 4..40, :if => Proc.new { |user| user.nickname.length > 1 } nor this one below? validates_length_of :nickname, :within
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
2007 Jul 24
13
Problem with validates_length_of an integer
Hello guys, I''m trying to validate the input of an integer from a form, here is a bit of code: This is the definition of the offending column in the migration: t.column :position, :integer, :default => 0, :limit => 3, :null => false And here is how I try to validate it inside de model: validates_length_of :position, :within => 1..3 And this is the exception I get when I