noosfero | Custom fields (#708)

Joenio Costa gitlab at gitlab.com
Mon Oct 19 16:56:48 BRST 2015


New comment for Merge Request 708

https://gitlab.com/noosfero/noosfero/merge_requests/708#note_2438047


Joenio Costa

maybe would be more interesting to use before_create instead of overwriting the constructor method here, see an example (code not tested):

```ruby
  before_create do |cf_value|
    if cf_value.custom_field && cf_value.customized
      cf_value.value ||= cf_value.custom_field.default_value
    end
  end
```

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151019/347e9a30/attachment-0001.html>


More information about the Noosfero-dev mailing list