On Lunes, 3 de Mayo de 2010 20:47:00 Iñaki Baz Castillo escribió:
> Hi, Client model has_many Addresses.
> The "addresses" table has a numeric column "mask" with default value 32.
>
> When creating a new Address a subform is shown in order to allow the
> user to assign an "address" for the current client. The problem is
> that the subform "port" field comes with "32" by default but sometimes
> I don't want to assign an "address". Unfortunatelly the Address model
> has a "validates_presence_of :ip", this means that when I press submit
> the "ip" is empty and the "mask" is "32" so it triggers a validation
> error ("ip cannot be blank).
>
> So the workaround is removing the default value of the table for the
> column "mask" but I wonder if there is a more ellegant to solve it.

You can disable showing a blank row for addresses:
config.columsn[:addresses].show_blank_record = false

-- 
Sergio Cambra .:: entreCables S.L. ::.
Mariana Pineda 23, 50.018 Zaragoza
T) 902 021 404 F) 976 52 98 07 E) [email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"ActiveScaffold : Ruby on Rails plugin" 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/activescaffold?hl=en.

Reply via email to