2010/5/3 Iñaki Baz Castillo <[email protected]>:
> 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.

Sorry, the above description is wrong and the report invalid. I've
fixed it by adding in "AddressesController":

  config.subform.columns.exclude [:client_id]

'client_id' is the foreing key for the "client" table. Sincerely I
don't understand why this does the job, any explanation? Thanks a lot.

-- 
Iñaki Baz Castillo
<[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