Hi,
I've started working with sequel, forme and Sinatra. Seems to be a
nice combination, and have been learning a lot from reading the
source, but am stuck on an issue. I'd like to create a new object,
assign it to a one_to_one field using the = method, and generate
(empty) form fields using subform in forme.
I'm using :null=>false constraints and validations, so an object with
empty fields is invalid, and the save fails. Even if I disable
validation on implicit save using :validate => false, I run into the
NOT NULL constraint at the database level, so how can I disable the
implicit save completely? Relevant code:
class Report
one_to_one :action, :validate=>false
...snip
# field with a constraint
class Action
Date :agreed_completion_date, :null=>false
...snip
# Run into the constraint here (implicit save in setter method)
if report.action.nil? then report.action = Action.new end
In associations.rb, and there don't seem to be any options to disable
the save. The comments suggest autosaving is not done for one_to_many,
so I could use that, but the actual auto-generated methods in
one_to_many seem to have saves in them. I'm sure there is a good
reason for this, but any suggestions on how I can make this work are
appreciated.
Bruce
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" 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/sequel-talk?hl=en.