Displaying 18 results from an estimated 18 matches for "validate_uniqueness_of".
Did you mean:
validates_uniqueness_of
2006 Mar 26
9
validate_uniqueness_of {combination of fields} ???
...m is that each record includes two fields, the _combination_ of which must be unique to the record set, but each of which may not be unique. So "sam smith", "mary smith" and "sam jones" (stored as fname, lname) all need to pass the validation.
Is there an easy way to validate_uniqueness_of a combination of fields within a record?
Thanks in advance for any help.
Best regards,
Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://wrath.rubyonrails.org/pipermail/rails/attachments/20060326/08cf5ae6/attachment.html
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 rubyonrails-talk-/JYPxA39Uh5TL...
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 solution.
http://dev.rubyonrails.org/ticket/3143
Tell me, should I patch...
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 a...
2006 Feb 11
2
validates_uniqueness_of - how to use multiple values for scope
...ion of results with these 3
properties. If someone tries to enter a new test result for a test thats
already been run on a certain environment with a certain build I want the
user to be prompted to update the existing result rather than create a new
one.
In the result model, I know I can use ....
validate_uniqueness_of :test_id, :scope => "xxxxx"
.... but I need it to be unique for 2 fields (environment and build)
Is there any way to pass 2 values into the scope attribute?
If not can anyone suggest how to update the validate_uniqueness_of method to
do this?
thanks
Iain
-------------- next part -...
2009 Sep 08
1
How to validate_uniqueness_of the joint of two attributes?
Hi,
I have a form that asks users to put in their :first_name and :last_name.
How do I validate that their full_name (first_name + last_name) is unique?
Thanks!
Nguyen Anh Hung
Assistant Project Manager/ Consultant/ Business Analyst
Tech Propulsion Labs
Mobile: +84987 005 477
Twitter: http://www.twitter.com/anhhung
Blog: http://www.fresco20.com
Skype: anhhung.n | Yahoo: hero.tuxer | Gtalk:
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 his information. When the user come to edit
his information we are not allowing the user to edit the password so
that we are hiding th...
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 Feb 23
3
Unable to update database object
This is really strange - hopefully someone out there may have seen
behavior like this before. I have a user successfully created in the
Users table of my application. When I try to update a single column
using:
@user = User.find(:first,
:conditions => ["login_name = ?",
@login_user.login_name])
@user.new_cookie_key
@user.save
I get the error:
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
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 to the INSERT (or UPDATE). However, in
between the SELECT and INSERT, an offending record might appear.
example race con...
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 Mar 05
2
Need help understanding Rails magic!
...How the heck is THAT happening ?!?!?!?
######
@allergy_list = Allergy.find(:all,
:conditions => ["emrec_id = ?", @emrec.id])
@allergy_list.each do |allergy|
allergy.destroy
end
######
# now add any new items. the model as a
# validate_uniqueness_of condition on description
# to avoid duplicate records
######
@allergy_item.update_attributes(params[:allergy_item])
for column in AllergyItem.content_columns
selected = @allergy_item.send(column.name)
if selected == ''y''
@allergy = Allergy.n...
2006 Jul 19
2
Creating a safe sequence generator
Hi all,
I''ve got a rails and database question. Accounts have jobs, and job
numbers should be assigned per account. Account 89 should have jobs
1-whatever, which are not the same as account 67, which has jobs
1-whatever.
In the past, I have accomplished this quite easily with:
create table job (
accountid int(10) unsigned not null default 0,
jobid int(10) unsigned not null
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
2006 Aug 17
2
how to check if the value is repeated?
hi!
as the subject says, :P how can i check if a value is already in a
table??
ty!!
--
Posted via http://www.ruby-forum.com/.
2007 Mar 29
21
a better "should have valid associations"
This is pretty much the same as last time around, if you recall.
Thanks to Wilson for converting to the new form. I''ve added a few
lines. Basically, it iterates over your model associations and does
two things.
- First, just try to call the association. Usually fixes speeling
erors or other such silliness.
- Second, try to find a record with an :include on the association.
This
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