similar to: Single Validation Error... best practices?

Displaying 20 results from an estimated 10000 matches similar to: "Single Validation Error... best practices?"

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
2005 Dec 15
4
Database best practices?
I started with rails a few weeks ago and I''ve been very impressed with the whole framework. My first project after the cookbook was a small application connecting to Postgres. This was originally a port of an Access application so I was delighted with the new facilities for constraint checks, triggers, etc. As I started to write the front-end though I noticed myself rewriting the
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:
2010 Jun 07
3
Model validation giving problem
Hi, I have a member registration form which takes a "Name", "Login", "Password", "Confirm Password" and "Location". In the user model I have added the validation validate_uniqueness_of :login, validate_presence_of :password, :name, :confirm_password. When the member tries to register every thing working fine. I am using same form for user to edit
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 May 05
10
have_one and have_present
>Comment By: Luis Lavena (luislavena) > Date: 2007-05-04 23:37 > describe "An Asset" do > before(:each) do > @asset = Asset.new > end > > it { @asset.should have_one(:attachment) } > it { @asset.should have_present(:something) } > end Food for thought on these. I like have_one a lot. It speaks to me as a Rails developer and I think it speaks to
2006 Jul 12
5
validates_peresence_of
Is there an expert validater that can point me in the right direction? I''ve looked for extended documentation on ''validates_presence_of'' but i can''t seem to find any. I''m trying to make sure that i don''t enter a nil object in my database, so i''ve added validate_presence_of to my Record Model. i.e. --> class Record <
2008 Sep 18
8
handling association changes? What's the best practice?
Hello all! I have a conundrum that I''m _sure_ someone else has already thought of and solved. How does one best handle the scenario of association object changes and data integrity? For example, if I have a standard ecommerce site that sells Products and people can have Orders and an Order has_many Products... then, what happens if Product #3 is part of Order #2 but at some point, the
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 Aug 11
6
rspec2 not working with shoulda
I am using rails edge. I am using gem "rspec-rails", "= 2.0.0.beta. 19" . I have following code at spec/models/user_spec.rb require ''spec_helper'' describe User do it { should validate_presence_of(:email) } it { should validate_presence_of(:name) } end Here is my gemfile group :development, :test do gem ''factory_girl_rails'',
2006 Jan 17
2
change error messages for Validation helpers?
Is it possible to change error messages for Validation helpers? I am writing an app against a existing database (so no control over column names), but when there is validation error (e.g. with validate_presence_of) I would like to customize the field name. For example for telephone whose field name is PhoneNumber I would like to chnage it to "Telephone Number cannot be empty" rather
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
2007 Feb 26
2
boolean db fields set to false fail validation with validates_presence_of?
I have a model that contains a :boolean field. In my view, I have a simple select of Yes or No, which equates to true or false, respectively. If I choose yes and save, everything works great. If I choose no, my model fails validation as I have this set as a required field using validates_presence_of. I have checked the log and it''s definitely set to false, why would this fail validation?
2018 Jan 30
0
Best practices in developing package: From a single file
On Tue, 2018-01-30 at 17:00 +0100, Suzen, Mehmet wrote: > Dear R developers, > > I am wondering what are the best practices for developing an R > package. I am aware of Hadley Wickham's best practice > documentation/book (http://r-pkgs.had.co.nz/).??I recall a couple of > years ago there were some tools for generating a package out of a > single file, such as using
2018 Jan 31
0
Best practices in developing package: From a single file
Dear Dr. Pfaff, Thank you for this, creating a package out of single file was my oriingal question, but not only creating and also maintaining it that way so R package is an artifact of the development process rather than "manually maintained" structure. I will have look at your sources. Best, Mehmet S?zen <suzen at acm.org> On 31 January 2018 at 15:51, Pfaff, Bernhard Dr.
2018 Jan 31
0
Best practices in developing package: From a single file
On 30/01/2018 4:12 PM, Dirk Eddelbuettel wrote: > > Mehmet, > > That is a loaded topic, not unlikely other topics preoccupying us these days. > > There is package.skeleton() in base R as you already mentioned. It drove me > bonkers that it creates packages which then fail R CMD check, so I wrote a > wrapper package (pkgKitten) with another helper function (kitten())
2018 Jan 31
0
Best practices in developing package: From a single file
On Tue, Jan 30, 2018 at 4:55 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 30/01/2018 4:30 PM, Kenny Bell wrote: >> >> In response to Duncan regarding the use of roxygen2 from the point of view >> of a current user, I believe the issue he brings up is one of correlation >> rather than causation. > > > Could be. However, I think editing
2018 Jan 31
1
Best practices in developing package: From a single file
>> There is package.skeleton() in base R as you already mentioned. It drove >> me >> bonkers that it creates packages which then fail R CMD check, so I wrote a >> wrapper package (pkgKitten) with another helper function (kitten()) which >> calls the base R helper and then cleans up it---but otherwise remains >> faithful to it. > > > Failing R CMD check
2018 Jan 31
0
Best practices in developing package: From a single file
On Wed, Jan 31, 2018 at 1:41 PM, Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 31/01/2018 6:33 AM, Joris Meys wrote: > > 3. given your criticism, I'd like your opinion on where I can improve the >> documentation of https://github.com/CenterForStatistics-UGent/pim. I'm >> currently busy updating the help files for a next release on CRAN, so your
2018 Feb 01
0
Best practices in developing package: From a single file
On 31/01/2018 6:59 AM, Duncan Murdoch wrote: > On 30/01/2018 11:39 PM, Hadley Wickham wrote: [ lots deleted ] >> Personally, I don't find writing in comments any harder than writing >> in .Rd files, especially now that you can write in markdown and have >> it automatically translated to Rd formatting commands. > > I didn't know about the possibility of