Displaying 20 results from an estimated 400 matches similar to: "New Gem: validation_hints"
2013 Apr 03
1
validates uniqueness scope allow_blank/allow_nil -> validation error
I have this in a model:
class GenreBadge < ActiveRecord::Base
  belongs_to :game, counter_cache: :genre_badges_count, touch: true
  belongs_to :genre
  validates :game_id, uniqueness: {scope: :genre_id}, allow_blank:
true
end
When I get one existing genre badge
genre_badge = game.genre_badges.first
genre_badge.game_id = nil
genre_badge.save!
It creates an validation exception:
2007 Nov 20
1
:allow_nil validation vs. blank?
I think I must be doing something wrong... when a form returns params
to the controller, empty fields appear to be returned as blank, not
nil.  so what''s the point of an :allow_nil=>true setting on a
validation? it fails because blank is not the same as nil.
i would expect either returned empty fields to be nil, or :allow_nil
to really be :allow_blank.  otherwise i have to do a search
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
2013 Jun 23
1
Contact form - NoMethodError (undefined method `each' for nil:NilClass)
Hi Guys,
So basically I want a contact form to appear on all the service pages.
I''ve already created a contact form for the contact page which works 
perfectly using this tutorial:
http://matharvard.ca/posts/2011/aug/22/contact-form-in-rails-3/
Now I would like to implement this approach on the service pages, and it 
works until I push the Submit button, when I get the following error:
2009 Jul 06
1
authlogic and updateing a user without changing password
Hi,
I created a new Rails app with authlogic to handle authentication and
what have you. In my admin section I''d like to change only the state of
users. The problem is that when I submit the form, I get the following
error: Password can''t be blank
How to tell authlogic to not care about this error? Is it possible to
provide te à-la restful_auth option :allow_blank => true ?
2010 Aug 18
0
paper clip plugin validation fails
hallo    friends i developpeda photo uploader using paper clip plugin
its   working  quite  well , but one problem is its able to upload all
kinds of  file. see i  want only  png,gif,jpeg and  should show error
message if validation fails.here if i applied validations in the model
the result is errors like this
ArgumentError (too few arguments):
  app/controllers/images_controller.rb:63:in
2011 Apr 21
1
Rails 3 Foreign Domain routing - cannot get this to work!
Hello,
    I''m trying to build an app (mysuperapp.com) that allows users to create
an account in which a default subdomain (IE: joeshmoe.mysuperapp.com) will
be 
created as their homepage.    In their profile settings, I also want to give
them the ability to add their own domain name so their homepage now can be
joeshmoe.com.    I know this is possible in rails w/ plugins like
subdomainfu
2010 Aug 18
7
error_messages_for doesn't work
I''m having a problem, ''cause I wrote the following line in my model
"Hi":
[code]
validates_numericality_of :phone, :only_integer => true, :allow_blank =>
false, :message => "must be a number"
[/code]
And in my "new" view, I put:
[code]
 <%= error_messages_for :oi,
                    :header_message => "Erro ao cadastrar
2013 Jan 02
4
distance_of_time_in_words_to_now
Hi There,
As I have learned the hard way, let me discuss my question, idea or feature 
here before doing actual work on it...
distance_of_time_in_words_to_now() seems to be unable to tell if this 
distance is in the future or in the past.
I''d really like to see ''in 5 days'' or ''5 days ago'' depending on, well, if 
it was 5 days ago or will be in 5
2011 Jun 19
10
validates_numercality_of with allow_nil.
In the model I have:
validates :square_meters_public_land, :barrier_meters, :numericality
=> { :greater_than_or_equal_to => 0 }, :allow_nil => true
but if, in the field, on create, I don''t insert a value I have the
error "field is not a number".
-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2010 Jun 15
8
Allow blank on should validate_uniqueness_of
Hello,
Using shoulda, any ideas how to allow blank when having this test:
should validate_uniqueness_of(:email)
Thanks.
--
J. Pablo Fernández <pupeno-GAtDADarczzQT0dZR+AlfA@public.gmane.org> (http://pupeno.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
2007 Dec 27
4
validates_file_format_of only when is there an image
i have a model with this:
file_column :image
validates_file_format_of :image, :in => ["gif", "png", "jpg"]
If inthe form the user not insert the image i receive an error.
If i remove:
validates_file_format_of :image, :in => ["gif", "png", "jpg"]
it works.
Is possible do the validation only when user insert the image in form?
i
2010 Jan 20
1
R.oo installation warnings?
I got the following warnings when I install R.oo. Are these warnings
normal? Should I reinstall the package as mentioned in the warnings?
How to reinstall? The sessionInfo() is at the end.
> install.packages("R.oo", dependencies=T)
Warning in install.packages("R.oo", dependencies = T) :
  argument 'lib' is missing: using '/utility/R'
also installing the
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
 -
2006 Aug 09
0
class validations - instance equivalent?
does anyone know if it''s possible to use rails validators from validate()
I have some conditional validation to do, and using :if => Proc.new... on 
the class validators is getting messy, so I''m doing the condition checking 
in one place - validate() - except of course I can''t use rails validators 
there. I''ve started writing my own validators but I hate to
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
2011 Aug 03
2
How to test modules and custom validators
I''m trying to have most of the important stuff tested and in order to do
that I run in front of some stuff I''m not quite sure which is the best way
to test them.
At this time I am having question around how to test modules and the custom
validators (the typical email format validator for example).
To test a module the best I saw up to now was finded here:
2009 Apr 26
1
validators.rb breaks after update from Rails 2.2.2 to 2.3.2
I just updated my rails application from 2.2.2 to 2.3.2 and the
following message is displayed while trying to start with ./script/
server:
[code]
=> Booting Mongrel
=> Rails 2.3.2 application starting on http://0.0.0.0:3000
/opt/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method'':
undefined method `valid?''
2008 Nov 17
7
super global dummy method for gettext + rails 2.2
Hi,
since rails 2.2 doesn''t work with gettext anymore I decided to use a
gettext dummy method until the gettext team relases a working version
for rails 2.2. My application doesn''t need any i18n support right now
and this way i figured it would be very easy to integrate gettext
later. Just setup the plugin and go.
So I need a method called _ which is available in alle models,
2008 Apr 09
1
chi-square test
Hi R-users,
I would like to find the goodness of fit using Chi-suare test for my data below:
xobs=observed data, xtwe=predicted data using tweedie, xgam=predicted data using gamma
> xobs <- c(223,46,12,5,7,17)
> xtwe <- c(217.33,39,14,18.33,6.67,14.67)
> xgam <- c(224.67,37.33,12.33,15.33,5.33,15)
> chisq.test(xobs, xtwe = xtwe, rescale.p = TRUE)
Error in chisq.test(xobs,