similar to: validates_uniqueness_of - how to use multiple values for scope

Displaying 20 results from an estimated 4000 matches similar to: "validates_uniqueness_of - how to use multiple values for scope"

2006 May 10
4
validates_uniqueness_of and create atomicity
Hi folks, I have a question regarding validates_uniqueness_of, and similar before-filter-like events attempting to guarantee some DB state prior to modification. >From my reading of ActiveRecord, validate_uniqueness_of appears to cause a SELECT on the underlying table attempting to ensure that a record with ID(s) specified in the validates_uniqueness_of statement is not already present, prior
2006 Jun 07
3
validates_uniqueness_of two fields
Is it possible to do a validates_uniqueness_of :name, :zip but only in that context? I''d like to be able to have that zip used again, but not in conjunction with a name already with that zip. Does that make sense? -- Posted via http://www.ruby-forum.com/.
2006 Mar 26
9
validate_uniqueness_of {combination of fields} ???
I''ve looked at the validates documentation and it appears that validates_uniqueness_of works on only one field at a time. So I can, for example, validate that "sam" is unique to the record set, and that "smith" is unique to the record set. My problem is that each record includes two fields, the _combination_ of which must be unique to the record set, but each of
2008 Sep 02
2
validates_uniqueness_of in update
I have a problem with the usage of validates_uniqueness_of that I hope someone can help throw a light on. With a new record, this validation works fine. But my problem came when I am updating a record. I was not able do it because it tells me that field value already exists. I was actually updating the value of other fields. According to the documentation which says "When the record is
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
2006 Apr 29
5
Getting Session ID
I thought I understood how to grab the session id but in the following code I am getting null for the session id: @foo = Foo.new(:session_id => session[:session_id], :test_id => @test.id) -- Posted via http://www.ruby-forum.com/.
2008 Sep 19
0
validates_uniqueness_of: passing a method to :scope
I was wondering if anybody knows an easy way to pass a method name as the scope option to a validates_uniqueness_of validation on a AR model? For example, I have nested models a bit like: class Survey has_many :areas end class Area belongs_to :survey has_many :questions, :order => ''position'' validates_uniqueness_of :position, :scope => : survey_id end class
2007 May 06
1
validates_uniqueness_of (with :scope) doesn't seem to work?
I have a master record called ''project'' and a child record called ''agycode''. Obviously, agycode has a project_id FK. I wish to make the "descr" field unique ONLY within the ''project_id'' ''scope''. Here are the key pieces of information Agycode fields (id, project_id, descr) Here''s the declaration in the
2006 Dec 06
2
validates_uniqueness_of where scope euqals created_by "magic" field
I have the following ActiveRecord objects: class Recipe < ActiveRecord::Base has_many :ratings, :dependent => true . . . end class Rating < ActiveRecord::Base validates_uniqueness_of :created_by, :scope => :recipe_id belongs_to :recipe, :counter_cache => true . . . end The created_by field on Rating is implemented as a "magic" field similar to this:
2012 Nov 08
1
validates_uniqueness_of(*attr_names) w scope not working in unit test
Rails 3.2.8 Very strange , it works in dv mode console , but not in a unit test class User < ActiveRecord::Base belongs_to :subdomain validates_uniqueness_of :email, :scope => :subdomain_id class UserTest < ActiveSupport::TestCase def initialize_user @booboo = FactoryGirl.create(:subdomain, name: "booboo") @coocoo = FactoryGirl.create(:subdomain, name:
2006 Mar 31
3
ID fields not getting picked up
For example I have table Questions. With fields id, text, and test_id. test_id is not being displayed in my view. I am hoping this means Rails has picked up that it is an id for another model. If so, then how do I utilize that? If not, then do I need to avoid ''id'' in any field names other than the main id field? Thanks! -- Posted via http://www.ruby-forum.com/.
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
2006 Aug 23
5
validation, concurrency, and transactions
Hi, Something has been bothering me about model validation: how do I know that the database has not changed in between when I validate my model''s data, and when it actually gets saved to the database? As a simple example, say I have a User model like: class User validates_uniqueness_of :username end When this gets saved to the database, the validation code checks that there is
2006 Feb 16
3
Apache lists contents of /public directory
I''m trying to get my rails app running on Apache. I''m running Apache 1.3.34and am only trying to get it working in CGI mode for now. I''ve followed the instructions in the Agile book, as well as searching this mailing list, but can''t figure this out. I''ve created the virtual directory in httpd.conf but when I try to lauch the app in my browser, I just
2006 Mar 05
2
Need help understanding Rails magic!
Hi, I''ve just been pleasantly surprised, again, by how much Rails does for me, but I am *really* surprised. Surprised as in "how the heck did that happen?" I''d really like to understand this and would appreciate any help. Big picture... the user is presented with a form that allows them to select one or more check boxes to record their allergies. The form uses the
2006 May 04
2
validates* give me problems
Hi All, I''m newbie to this tool and following some tutorials I''ve came across with this problem when configuring my webpage: In Debian/testing, ruby1.8, rails1.1 I create my audio application which connects to a database (mysql) named audio with tables: articulos(id,titulo,descripcion,created_on,categoria_id) and categorias(id,titulo) after creating and modifying the
2012 Aug 04
2
ggplot2 boxplot help
Hello, I have a data set that looks like this: name G-ID test_id g-id g 1 00077464 C_068131 C_068131 OC_068131 - 2 00051728 C_044461 C_044461 OC_044461 - 3 00058738 C_050343 C_050343 OC_050343 - 4 00059239 C_050649 C_050649 OC_050649 - 5 00001761 C_000909 C_000909 OC_000909 - 6 00005119 C_002752 C_002752 OC_002752 - locs
2001 May 25
1
ssh-keygen segfault (2.9p1)
On Fri, May 25, 2001 at 02:21:06PM +0200, Nigel Kukard wrote: > Hi, > > [nkukard at wigglytuff .ssh]$ ssh-keygen -pf test_id > Enter old passphrase: > 'ey has comment 'ii > Enter new passphrase (empty for no passphrase): > Enter same passphrase again: > Segmentation fault (core dumped) > [nkukard at wigglytuff .ssh]$ > > > That is the error
2005 Dec 14
0
validate_uniqueness_of builds queries with IS NULL when value is nil (since RC 5)
Hi people, Ever since RC 5 (including 1.0) my unit tests that test for inserting duplicate entries fail and throw errors. Each of them implements validate_uniqueness_of to prevent duplicates. While I also put in a ticket for this, I''m wondering if this is actually a defect or maybe intended behaviour afterall. If so, I won''t apply the patch again and look for another
2008 Mar 18
0
Case sensitive validate_uniqueness_of isn't working
Hi, validate_uniqueness_of has the option :case_sensitive, this option is true by default, there are tests to check that :case_sensitive => false is working, but there isn''t any test to check that, when set to true (the default!), is working, in fact it doesn''t work at. There isn''t a database agnostic way to do a case sensitive search, there is in myql (binary like)