Validation problems with has_many :accessible => true
Reported by Adam Hoscilo | June 19th, 2009 @ 10:50 AM | in Hobo 1.0 - Final
Description (on hobo 0.8.7):
Category:
has_many :things, :dependent => :destroy, :accessible => true
Thing:
fields do
price :decimal, :precision => 6, :scale => 2
is_active :boolean, :default => true
timestamps
end
belongs_to :category
belongs_to :thing_pattern
has_many :somethings
validates_presence_of :price, :category, :thing_pattern
<def tag="form" for="Category">
...
<hr/>
<div param="things-forms">
<p><b>Things:</b></p>
<input-many:things>
<div param="card">
<field-list fields="price, thing_pattern"/>
<check-many:somethings/>
</div>
</input-many>
</div>
Problem:
After saving this form things are created first, what leads to
validation error on category. Partial solution is to make
validation :on => :update but that can make the data
inconsistent
Solution:
Maybe first create main model, then all associations?
Comments and changes to this ticket
-
Adam Hoscilo July 1st, 2009 @ 04:38 PM
Can someone confirm this bug? I had to change many of my validations to :on => :update to make my app work.
-
Bryan Larsen October 22nd, 2009 @ 09:44 PM
- Tag changed from defect to associations, defect
-
Tom Locke October 24th, 2009 @ 05:54 PM
- Milestone set to Hobo 1.0 - Final
-
Tom Locke October 24th, 2009 @ 06:09 PM
- State changed from new to open
-
Bryan Larsen November 24th, 2009 @ 09:34 PM
I've opened a bug against Rails for this one: https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets...
-
Bryan Larsen November 24th, 2009 @ 09:37 PM
- State changed from open to resolved
(from [d984386b5c58dff4d1d445c6c52550d3fb61e3bc]) [#447 state:resolved] Work around rails bug #3510 http://github.com/tablatom/hobo/commit/d984386b5c58dff4d1d445c6c525...
-
Bryan Larsen December 10th, 2009 @ 07:48 AM
(from [4fbe02f0541d94024b762d989887b66d51a91899]) [#447] The fix for #447 broke has_many :through associations http://github.com/tablatom/hobo/commit/4fbe02f0541d94024b762d989887...
Please Sign in or create a free account to add a new ticket.
With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
People watching this ticket
Tags
Referenced by
- 447 Validation problems with has_many :accessible => true (from [d984386b5c58dff4d1d445c6c52550d3fb61e3bc]) [#447 s...
- 448 Problem with has_many accessible => true - empty records This might be bug #447, which I just fixed.
- 447 Validation problems with has_many :accessible => true (from [4fbe02f0541d94024b762d989887b66d51a91899]) [#447] ...
- 447 Validation problems with has_many :accessible => true (from [4fbe02f0541d94024b762d989887b66d51a91899]) [#447] ...