All Questions
Tagged with ruby-on-rails validates-associated
9
questions
0
votes
0
answers
34
views
HABTM relationship / validates associated: valid? is true even though I don't think it is
I made the following join table to be used in a HABTM relationship between tasks and itself:
create_table :tasks_tasks, id: false do |t|
t.belongs_to(
:dropoff_task,
null: false,
...
0
votes
1
answer
75
views
Validates_overlap custom message?
i try the gem validates_operator.
I need to custom my message for this validation:
validates :arrival_date, :departure_date, overlap: {
scope:"place_id",
message_title: "Error",
...
1
vote
3
answers
870
views
Rails 4 form - text field value must match a value in an associated table (autocomplete)
I have two associated models/tables
app/models/city.rb
has_many :businesses
Fields: id, city_name, state_code
app/models/business.rb
belongs_to :city
Fields: id, biz_name, address, city_name, ...
0
votes
1
answer
363
views
has_one validates_associated firing inconsistently despite 'on: :create'
I'm seeing really weird behaviour when checking valid? on a model that has a validates_associated :contact, on: :create. If I make two calls to valid? the first is true and the second is false.
This ...
2
votes
1
answer
2k
views
Using :autosave for has_one association: How to show the parent's errors when on the child's controller?
I have created a model that looks like this:
class Parent < ActiveRecord::Base
attr_accessible :child, :child_id
has_one :child, :class_name => 'Child', :autosave => true, :inverse_of =&...
2
votes
1
answer
78
views
Rails : Displaying associated model validations
I have got three models
class RateCard < ActiveRecord::Base
validate :name, :presence => true, :uniqueness => true
has_many :rate_card_countries, :dependent => :destroy
has_many :...
1
vote
2
answers
3k
views
ActiveModel: Disable failing validation when associated models fail
Does Rails3 always run validates_associated against all models by default?
In a simple setup like this
class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::...
12
votes
2
answers
8k
views
validates_associated not checking existence of associations
Can anyone figure out what's going on here? I was able to get my code to work the way I want it to, but I can't figure out why validates_associated isn't working as I expect. Here's a snippet of my ...
18
votes
4
answers
9k
views
Better validates_associated method for Rails 3?
Rails 3 includes the validates_associated which is automatically called when saving a nested model. The problem with the method is the message is terrible - "Model(s) is invalid"
There have been a ...