Is it possible to set conditionals on a field for a model?

The reason I ask, is I have a default value set for a number of
fields, where the field is a string, and defaults normally to ' ' for
the first instance of the model.

i.e

field_one        :string, :required, :default => ''

The user when creating a new model, has a drop down 'select' to choose
the value for this field as 'Yes' or 'No'

i.e

<field_one-view:> <select-input options="&[['?', ''], ['Yes', 'Yes'],
['No', 'No']]"/> </field_one-view:>

But for any subsequently created models relating to the first version
created, I would like the value of this field to then default to the
previous value set for that last model.

So for Model 1, the user is presented with a blank option, and then
selects 'Yes' for field_one.

But for Model 2, rather than the value defaulting to '' again, I would
like it to automatically default to 'Yes' this time.

Is it possible to set the values of the fields in this way?

something like - if self.first_version,

 field_one = ''

else

field_one =

-- 
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.

Reply via email to