Displaying 6 results from an estimated 6 matches for "m000816".
Did you mean:
000816
2006 Jun 27
4
Not Active Record Model Validation
I have a problem with ruby on rails validation
total_book_toy.rhtml
================
<%= text_field ''book1'', ''title1'' %>
<%= text_field ''book2'', ''title2'' %>
I want to validate these text_field so user can''t insert same title.
However, I was stuck how to do it.
Or maybe you have another way how to do it.
2006 Jun 14
3
Prevent duplicate HABTM associations
Hi,
I am trying to restrict duplicate has_and_belongs_to_many associations.
I tried to find support for a association validation for duplicates but
couldn''t find anything.
I understand I could use :uniq=>true on the model association but this
would only prevent it from displaying duplicates, I want to stop
duplicate associations being inserted in the first place.
I have a vague
2006 Nov 29
2
validates_uniqueness w scope
In a one-to-many relationship (domain has_many :categories and
category belongs_to :domain)
In the category model I use:
validates_uniqueness_of :name, :case_sensitive => false
but upon creation of a category this validation is performed on ALL
domains,
can I restrict it only to the categories of the current domain, the to
which teh category being saved belongs_to ? if yes ? how ?
thanks
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 Jul 18
3
Newbie validation question
I am having problems with a validation, the full model code is below.
The validate routine is attempting to see if another record with the
same artist_name, title, & catalogue_no exists in the products table. If
so, it should throw an error.
This is the validation code:
def validate
if Product.find(:all, :conditions => ["artist_name = ?, title = ?,
catalogue_no = ?",
2006 Oct 12
2
How do I test a unique index?
I have a loans table and a payments table. Each loan has_many payments.
So far no problem.
Now, the payments table has a payment_number field, and each payment has
a payment_number unique within that loan. For example, Loan A can have
payment_numbers 0, 1, and 2 and Loan B can have payment_numbers 0, 1, 2,
and 3 (but only one of each payment_number). I can enforce this with a
unique index in