validates-uniqueness-of Questions
4
Solved
A have two models, "shop" and "product", linked via has_many :through.
In the shop form there are nested attributes for multiple products, and I'm having a little trouble with the product's unique...
Hermie asked 30/3, 2011 at 6:35
3
Solved
Here is code which is not working
class WeekDay < ActiveRecord::Base
validates_inclusion_of :day, :in => %w(sunday monday tuesday wednesday thursday friday saturday), :case_sensitive =>...
Sicken asked 24/3, 2011 at 0:19
5
Solved
I have a Project model which accepts nested attributes for Task.
class Project < ActiveRecord::Base
has_many :tasks
accepts_nested_attributes_for :tasks, :allow_destroy => :true
end
class...
Setsukosett asked 5/5, 2010 at 10:12
2
Solved
I have a problem with the scoped uniqueness validation in Rails for nested attributes with a parent of parent.
Background
I have a rails 4 application with 3 models :
#app/models/account.rb
cl...
Moazami asked 25/6, 2014 at 19:5
3
Solved
I have a Question class:
class Question < ActiveRecord::Base
attr_accessible :user_id, :created_on
validates_uniqueness_of :created_on, :scope => :user_id
end
A given user can only crea...
Wier asked 3/1, 2014 at 23:54
1
Solved
I've got the following (sanitized) models:
class Person < ActiveRecord::Base
attr_accessible :name, :first_name, :last_name, :age, :job_title, :salary, :ssn, :prison_convictions, :addresses_...
Uncertainty asked 26/1, 2013 at 6:56
2
Solved
I have the following models, which basically are trying to mean that a professor has knowledge of many subjects for a particular level. The subjects are fixed, so there will be no new subjects crea...
Pastoralize asked 30/6, 2012 at 5:26
2
I have the following in my migration file
def self.up
create_table :payment_agreements do |t|
t.boolean :automatic, :default => true, :null => false
t.string :payment_trigger_on_order
t...
Marquess asked 28/5, 2010 at 5:15
1
Solved
In Rails 2.x you can use validations to make sure you have a unique combined value like this:
validates_uniqueness_of :husband, :scope => :wife
In the corresponding migration it could look li...
Croix asked 28/3, 2010 at 15:54
1
Is there any way I can validate a value updated in a Core Data entity's property against values of the property in other entities in the collection?
At the moment I create an entity with some defa...
Dipper asked 10/3, 2010 at 8:56
1
Solved
I have a model that has two fields, which I will call first_name and last_name, and I want to make sure that the combination of the two are case-insensitively unique. I've gotten halfway there by u...
Alister asked 6/2, 2010 at 23:50
3
Solved
The uniqueness validator of ActiveRecord has an options to skip validation if the value is nil or blank. Even if I set both parameters to true (the default behaviour) I can create one record with n...
Falcone asked 26/9, 2009 at 2:1
1
© 2022 - 2024 — McMap. All rights reserved.