This may be a little tangential but I am wondering how many hobo users make use of DB constraints to supplement rails validations?
I'm not a SQL maven by any stretch, buy using an RDBMS without using constraints feels like paying for a DB without leveraging it's value. Sent from my iPhone On Feb 18, 2011, at 12:45 PM, "Donald R. Ziesig" <[email protected]> wrote: > Hi Matt, et. al.: > > Well I may have missed something in the addition of the invalid record and > the interaction with before_save, but I still can't get an error when the > child is invalid. (in the test app, there is no invalid record saved, but > still no error message); > > I created a test app with a parent table and a children table, both of which > initially had only name:string as columns (appropriate columns were added > later by hobo g migration). > > added to parent model: > > has_many :children > children :children > > validates_presence_of :name > > ===== > > added to child model: > > belongs_to :parent > validates_presence_of :name > > ===== > > added to children controller: > > auto_actions_for :parent, [:create] > > ============================================ > > Not much to type ;-) > > performed hobo g migration > > ===================================== > > Performed the following tests: > > ===== > > Added parent with no name: > > Got big red box saying Name can't be blank. No parent added. > > ===== > > Added parent "Mama" > > got to the show page for Mama, with Add Children box: > > Pressed "Add" with a blank Name field. > > Got an empty "Child" page with NO ERROR, but with a link back to the parent > page. > > Followed the link to the parent page. Mama had NO children - so even though > I got a blank child to look at (in the other apps, which had more columns, > they were displayed with the values I entered), the record was not saved. > > ===== > > Added child "Suzie", pressed "Add" > > Got Suzie's child page. went back to Mama and Suzie was there. > > ===== > > I don't know if attachments will get through to the list, but the tgz file is > less than 200K and is ready to run > > ===== > > I'm going back to look at the before_save issue in my primary app (its > complicated enough that I probably messed it up somewhere or > misinterpreted the results). > > Thanks, > > Don Z > > On 2/18/2011 11:09 AM, Matt Jones wrote: >> >> On Feb 18, 2011, at 11:02 AM, Donald R. Ziesig wrote: >> >>> I hacked around the addition of the invalid record - I don't remember >>> seeing this in any documentation so I worry about the future. >>> >>> It appears that returning false or nil from before_save when there is an >>> error stops the record from being saved YMMV. >>> >>> I still can't make the error message(s) appear though. >> This definitely shouldn't be happening - I've got apps in production that >> use validations along with auto_actions_for and they work fine. >> >> The fact that you're *getting* to the before_save callbacks indicates that >> something else is disabling validations, as a failed validation should >> cancel the save before it even gets to those... >> >> --Matt Jones >> > > -- > You received this message because you are subscribed to the Google Groups > "Hobo Users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/hobousers?hl=en. > <parent_child_test.tgz> -- You received this message because you are subscribed to the Google Groups "Hobo Users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/hobousers?hl=en.
